Only output events for a condition when at least a single event matching the condition has been found, else output the input
<p>My input has a field 'condition' with only two values. Lets assume only values 'A' or 'B'.</p>

<p>When at least a single event with condition=A within a tumbling window is found, only events with condition=A should be outputted. However, when no events for A are found, only events with B should be outputted in the same window.
Given the following input with a tumbling window of 4 ticks:</p>

<pre><code>  Condition   Time  
 ----------- ------ 
  A           T1    
  B           T2    
  A           T3    
  B           T5    
  B           T6    
  B           T7    
  B           T8    
  B           T10   
  A           T11   
  A           T12   
  A           T13   
  A           T14   
  A           T15   
</code></pre>

<p>The output should be as follows:</p>

<pre><code>  Condition   Time   (Window)  
 ----------- ------ ---------- 
  A           T1     T1-3      
  A           T3     T1-3      
  B           T5     T5-8      
  B           T6     T5-8      
  B           T7     T5-8      
  B           T8     T5-8      
  A           T11    T9-12     
  A           T12    T9-12     
  A           T13    T13-16    
  A           T14    T13-16    
  A           T15    T13-16    
</code></pre>

<p>How can I setup my steps so the following output is achieved from my input?
I tried several option with using group but was unsuccessful </p>