{"raw_statement":[{"iden":"problem statement","content":"There is a $10^9$\\-story building with $N$ ladders.  \nTakahashi, who is on the $1$\\-st (lowest) floor, wants to reach the highest floor possible by using ladders (possibly none).  \nThe ladders are numbered from $1$ to $N$, and ladder $i$ connects the $A_i$\\-th and $B_i$\\-th floors. One can use ladder $i$ in either direction to move from the $A_i$\\-th floor to the $B_i$\\-th floor or vice versa, but not between other floors.  \nTakahashi can freely move within the same floor, but cannot move between floors without using ladders.  \nWhat is the highest floor Takahashi can reach?"},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq A_i, B_i \\leq 10^9$\n*   $A_i \\neq B_i$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\ldots$\n$A_N$ $B_N$"},{"iden":"sample input 1","content":"4\n1 4\n4 3\n4 10\n8 3"},{"iden":"sample output 1","content":"10\n\nHe can reach the $10$\\-th floor by using ladder $1$ to get to the $4$\\-th floor and then ladder $3$ to get to the $10$\\-th floor."},{"iden":"sample input 2","content":"6\n1 3\n1 5\n1 12\n3 5\n3 12\n5 12"},{"iden":"sample output 2","content":"12"},{"iden":"sample input 3","content":"3\n500000000 600000000\n600000000 700000000\n700000000 800000000"},{"iden":"sample output 3","content":"1\n\nHe may be unable to move between floors."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}