#d1702. 数字替换
数字替换
Number Replacement
Problem Description
Maintain a number sequence, initially empty.
There are operations in total, of two types:
1 x— append the number to the end of the sequence.2 x y— replace the value of every number currently equal to in the sequence with .
After the operations, output the sequence.
Input Format
The first line contains an integer , the number of operations.
Lines to each describe one operation.
Output Format
One line containing the final sequence.
Sample Input
7
1 3
1 1
2 1 2
1 2
1 1
1 2
2 1 3
Sample Output
3 2 2 3 2
Constraints