close

import java.util.Scanner;
public class UVa10152 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int times = input.nextInt();
        for (int t = 1; t <= times; t++) {
            int num = input.nextInt();
            num++;
            String[] before = new String[num];
            String[] after = new String[num];
            int j = num - 1;
            for (int i = 0; i < num; i++)
                before[i] = input.nextLine();
            for (int i = 1; i < num; i++)
                after[i] = input.nextLine();
            for (int i = num - 1; i > 0; i--) {
                if (before[i].compareTo(after[j]) == 0)
                    j--;
            }
            for (int i = j; i > 0; i--)
                System.out.println(after[i]);
            System.out.println();
        }
    }
}

 

arrow
arrow
    文章標籤
    UVa JAVA code
    全站熱搜
    創作者介紹
    創作者 蒼雨 的頭像
    蒼雨

    日常雜物間

    蒼雨 發表在 痞客邦 留言(0) 人氣()