• [G] Gank

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • In League of Legends, gank is an important way to kill enemies.
    The common method is to hide in a underbrush and wait for their arrival.
    But the problem is - Not all the underbrush will be appropriate. If one underbrush is the only way which must be passed from one certain underbrush to another certain underbrush, we say it's a 'Dangerous Underbrush'.
    Now give you N underbrush and their connectedness. You should tell Garen all the 'Dangerous Underbrush' so that he can hide in it.

    You can refer to the picture below:

    You should consider that all the underbrush is connected directly or not directly.

  • 输入
  • This problem contain several cases.
    The first line is a integer N. (3 <= N <= 100).
    Then follow N lines.
    The first integer of ith line Mi indicates the underbrush number of ith underbrush connects directly. (The connections is undirected).
    Then follow Mi integers, indicates the each underbrush that the ith underbrush connects with.
  • 输出
  • For each case, you should find all the 'Dangerous Underbrush', order by identifier increasing. If there's no 'Dangerous Underbrush', then print 'Garen is hapless'.
  • 样例输入
  • 6
    1 4
    0
    0
    0
    3 0 1 5
    3 2 3 4
    
  • 样例输出
  • 4 5
    
  • 提示
  • 来源
  • XadillaX
  • 操作

显示春菜