#include #include #include #include #include #include using namespace std; const int MAXV = 10001; int n; struct Cond { string val; int l, r; Cond() { l = -MAXV; r = MAXV; } }; vector data[1010]; map M; bool add(Cond cond) { Cond& c = M[cond.val]; if (cond.l > c.l) { c.l = cond.l; } if (cond.r < c.r) { c.r = cond.r; } return c.l <= c.r; } bool caln(int a, int b) { M.clear(); for (int i = 0; i < data[a].size(); i++) { if (!add(data[a][i])) { return false; } } for (int i = 0; i < data[b].size(); i++) { if (!add(data[b][i])) { return false; } } return true; } int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); cin >> n; scanf("\n"); for (int i = 1; i <= n; i++) { string input; getline(cin, input); stringstream fin(input.c_str()); string val, comma, oper; int num; while (fin >> val) { fin >> oper >> num; Cond cond; cond.val = val; if (oper == ">") { cond.l = num + 1; cond.r = MAXV; } else if (oper == ">=") { cond.l = num; cond.r = MAXV; } else if (oper == "<") { cond.l = -MAXV; cond.r = num - 1; } else if (oper == "<=") { cond.l = -MAXV; cond.r = num; } else if (oper == "==") { cond.l = cond.r = num; } data[i].push_back(cond); if (!(fin >> comma)) { break; } } bool unique = true; for (int j = 1; j < i; j++) { if (caln(i, j)) { if (!unique) { printf(" "); } printf("%d", j); unique = false; } } if (unique) { printf("unique"); } printf("\n"); } return 0; }