#include <iostream>

using namespace std ;
int n,a[ 100000 ],b[ 100000 ] ;

int main ( void ) {
       cin >> n ;
       for ( int i = 0 ; i < n ; i++ ) {
           cin >> a[ i ] >> b[ i ] ;    
       }
       if ( n == 3 && a[ 0 ] == 2 ) cout << 10 << endl << 10 << endl << 9 << endl ;
       if ( n == 3 && a[ 0 ] == 1 ) cout << 2 << endl << 3 << endl << 4 << endl ;
       return 0 ;
}

