A parliament in a faraway country has N members. From Monday to Friday of this week every member came to work and argued all day about the amendment to the new referendum law.
A reporter photographed the chamber once a day for those five days, each time in the middle of the argument. One photograph holds the pairs of members quarreling face to face. You analyze all five photographs.
Every member belongs to one of two parties, written A and B. Decide the party of each member so that no member quarreled with more than two members of their own party.
The same pair can appear in the photographs of several days. Such a pair still counts as one quarreling partner for each of the two members.
The first line contains the number of members N (2≤N≤200000). Members are numbered from 1 to N.
The next five lines describe the photographs of Monday to Friday in that order. Each line lists the pairs of quarreling members in that day's photograph. First comes the number of pairs P (1≤P≤N/2), then P pairs in the form "K L", where K and L are the numbers of the two members quarreling with each other. Two spaces come before each pair. A member appears at most once per line.
Print one line with a string of length N made of the characters A and B. The Kth character is the party of member K.
Many assignments satisfy the condition, so only the assignment this procedure produces is accepted.
A member appears at most once per photograph, so a member has at most five quarreling partners. A member who moves therefore has at most two quarreling partners in the new party right after the move, and the number of pairs that quarreled inside one party drops with every move. The procedure ends.