/* * Author: * Indestinee * Date: * 2016/05/14 */ #include #include #include #include #include #include #include #include #include using namespace std; map mp; int l[1100][40], r[1100][40], tmpl[40], tmpr[40]; string s, a, b; int c, cnt; vector ans; const int inf = 1e9+7; int main(){ // freopen( "E.in" , "r" , stdin ); // freopen( "E.out" , "w" , stdout ); int n; scanf( "%d" , &n ); for( int i = 1 ; i <= n ; i ++ ) for( int j = 0 ; j < 40 ; j ++ ) l[i][j] = -inf, r[i][j] = inf; getline( cin , s ); for( int id = 1 ; id <= n ; id ++ ){ getline( cin , s ); int i = 0, sz = s.size(); while( i < sz ){ while( i < sz && s[i] == ' ' ) i ++; if( i == sz ) break; a = b = ""; c = 0; while( i < sz && s[i] >= 'a' && s[i] <= 'z' ) a += s[i++]; while( i < sz && s[i] == ' ' ) i ++; while( i < sz && s[i] != ' ' ) b += s[i++]; while( i < sz && s[i] == ' ' ) i ++; while( i < sz && s[i] >= '0' && s[i] <= '9' ) c = c * 10 + s[i++] - '0'; while( i < sz && s[i] == ' ' ) i ++; if( i < sz && s[i] == ',' ) i ++; if( mp[a] == 0 ) mp[a] = ++cnt; int x = mp[a]; // cout << a << " " << b << " "<< c << " " << x << endl; if( b == ">" ) l[id][x] = max( l[id][x] , c + 1 ); else if( b == ">=" ) l[id][x] = max( l[id][x] , c ); else if( b == "<" ) r[id][x] = min( r[id][x] , c - 1 ); else if( b == "<=" ) r[id][x] = min( r[id][x] , c ); else{ r[id][x] = min( r[id][x] , c ); l[id][x] = max( l[id][x] , c ); } } for( int j = 1 ; j < id ; j ++ ){ bool ok = true; for( int i = 1 ; i <= cnt ; i ++ ){ if( max( l[j][i] , l[id][i] ) > min( r[j][i] , r[id][i] ) ) ok = false; } if( ok == true ) ans.push_back( j ); } if( ans.empty() ){ puts( "unique" ); }else{ for( int i = 0 , sz = ans.size() - 1 ; i <= sz ; i ++ ) printf( "%d%c" , ans[i] , i == sz ? '\n' : ' '); ans.clear(); } } return 0; }