The first line will contain an integer X with X ≥ 0. The next X lines will each consist of
two different names, separated by a single space. These two students must be in the same
group.
The next line will contain an integer Y with Y ≥ 0. The next Y lines will each consist of
two different names, separated by a single space. These two students must not be in the
same group.
Among these X + Y lines representing constraints, each possible pair of students appears at
most once.
The next line will contain an integer G with G ≥ 1. The last G lines will each consist of
three different names, separated by single spaces. These three students have been placed in
the same group.
Each name will consist of between 1 and 10 uppercase letters. No two students will have
the same name and each name appearing in a constraint will appear in exactly one of the G
groups.
第一行将包含一个整数 X,X ≥ 0。接下来的 X 行中,每行将包含两个不同的名字,之间用一个空格分隔。这两个学生必须在同一个小组。
下一行将包含一个整数 Y,Y ≥ 0。接下来的 Y 行中,每行将包含两个不同的名字,之间用一个空格分隔。这两个学生不能在同一个小组。
在这 X + Y 行代表约束的行中,每对可能的学生组合最多出现一次。
下一行将包含一个整数 G,G ≥ 1。最后的 G 行中,每行将包含三个不同的名字,之间用单个空格分隔。这三个学生已被安排在同一个小组。
每个名字将由 1 到 10 个大写字母组成。没有两个学生会有相同的名字,并且每个出现在约束中的名字将在 G 个小组中的一个中准确出现。