#include #include #define rep(E, F) for (E = 0; E < (F); E++) int get_int() { int r = 0, c = getchar(), s = 1; while (c != '-' && c < '0' || c > '9') c = getchar(); while (c == '-') s *= -1, c = getchar(); while (c >= '0' && c <= '9') r = r*10 + c - '0', c = getchar(); return s*r; } int p[2000001]; int find(int x) { return p[x] < 0 ? x : (p[x] = find(p[x])); } void join(int x, int y) { int rx = find(x), ry = find(y); if (rx == ry) return; if (p[rx] > p[ry]) p[ry] += p[rx], p[rx] = ry; else p[rx] += p[ry], p[ry] = rx; } int main() { int i, n = get_int(), q = get_int(); rep(i, n) p[i] = -1; while (q--) { int z = get_int(), x, y, a, b; if (z == 1) { x = get_int() - 1, y = get_int() - 1; while (x < y) join(x++, y--); } else if (z == 2) { x = get_int() - 1, y = get_int() - 1, a = get_int() - 1, b = get_int() - 1; if (y - x != b - a) { printf("Not equal\n"); continue; } while (x <= y && find(x) == find(a)) x++, a++; printf("%s\n", x <= y ? "Unknown" : "Equal"); } else assert(0); } return 0; }