#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair PII; #define fi first #define se second #define MP make_pair int read() { int v = 0, f = 1; char c = getchar(); while (c < 48 || 57 < c) {if (c == '-') f = -1; c = getchar();} while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar(); return v * f; } char ch1[40], ch2[5]; char ch[10000]; int mp[7000000]; int cnt, tot; int A[1001], n; int a[1001][31][2]; int now; void ha() { memset(ch1, 0, sizeof ch1); memset(ch2, 0, sizeof ch2); int ch3; sscanf(ch + now, "%s%s%d", ch1 + 1, ch2 + 1, &ch3); ull tmp = 0; for (int i = 1; ch1[i]; i++) tmp = (tmp * (ull)233 + (ull)ch1[i]) % 6662333; if (mp[tmp] == 0) mp[tmp] = ++tot; int t = mp[tmp]; if (ch2[1] == '<' && ch2[2] == 0) a[cnt][t][1] = min(a[cnt][t][1], ch3 - 1); if (ch2[1] == '>' && ch2[2] == 0) a[cnt][t][0] = max(a[cnt][t][0], ch3 + 1); if (ch2[1] == '<' && ch2[2] == '=') a[cnt][t][1] = min(a[cnt][t][1], ch3); if (ch2[1] == '>' && ch2[2] == '=') a[cnt][t][0] = max(a[cnt][t][0], ch3); if (ch2[1] == '=' && ch2[2] == '=') { a[cnt][t][0] = max(a[cnt][t][0], ch3); a[cnt][t][1] = min(a[cnt][t][1], ch3); } while (ch[now] != ',') now++; now++; } int main() { n = read(); for (int i = 1; i <= n; i++) for (int j = 1; j <= 30; j++) a[i][j][0] = -10000, a[i][j][1] = 10000; while (cnt < n) { cnt++; for (int i = 0; i < 10000; i++) ch[i] = 0; gets(ch); ch[strlen(ch) + 1] = ','; now = 0; while (ch[now]) ha(); } for (int i = 1; i <= n; i++) { A[0] = 0; for (int j = 1; j < i; j++) { bool flg = 1; for (int k = 1; k <= 30; k++) if (max(a[i][k][0], a[j][k][0]) > min(a[i][k][1], a[j][k][1])) flg = 0; if (flg) A[++A[0]] = j; } if (A[0] == 0) puts("unique"); else { for (int i = 1; i < A[0]; i++) printf("%d ", A[i]); printf("%d\n", A[A[0]]); } } }