## UNTITLED - Untitled Problem

We consider a sequence **S _{1}** is

**equal**to a sequence

**S**, if and only if they satisfy the following conditions:

_{2}- The length of them are equal.
- Let
**Len**be the length of them. For each i, j (1 <= i, j <=**Len**, i != j):If**S**[i] is smaller than_{1}**S**[j],_{1}**S**[i] must be smaller than_{2}**S**[j]; If_{2}**S**[i] is greater than_{1}**S**[j],_{1}**S**[i] must greater than_{2}**S**[j]._{2}

Now you are given a sequence **S** and another **N** sequences **T _{1}**,

**T**….

_{2}**T**.

_{N}We say position **i** is **OK**, if and only if **S** [1..**i**] contains a suffix which is **equal** to a sequence from { **T _{1}**,

**T**...

_{2}**T**}. You need to print the positions which is

_{N}**OK**in increasing order.

### Input

Multiple test cases, the number of them(no more than 3) is given in the very first line.

For each test case:

- The first line contains an integer
**M**(**M**> 1) which denote the number of sequences.**i.e.****M**=**N**+ 1. **M*** 2 lines follow, each two lines describe one sequence. For each two lines, the first line contains an integer**L**which denote the length of this sequence. The second line contains**L**integers (all the integers don't exceed 2^{31}-1) that represent this sequence. The first sequence described is**S**, the next**N**sequences represent**T**..._{1}**T**._{N}- You can assume that there are no same integer in any one sequence.
- The length of
**S**is no more than 400000, and the total length of**T**is no more than 100000.

### Output

For each test case: Print the positions which is **OK** in increasing order.

### Example

Input:2 2 1 1 1 2 3 3 3 1 2 2 4 5 2 10 1Output:1 2 3

Added by: | Qu Jun |

Date: | 2008-05-19 |

Time limit: | 1s |

Source limit: | 50000B |

Memory limit: | 1536MB |

Cluster: | Cube (Intel G860) |

Languages: | All except: C99 ERL JS-RHINO NODEJS PERL6 VB.NET |

Resource: | Based on a problem from USACO 2005 Dec Gold Division |