#include<iostream> #include<cstdlib> #include<cstdio> #include<algorithm> #include<map> usingnamespacestd; inlineintread() { int f = 1, x = 0; char ch;
do{ ch = getchar(); if (ch == '-') f = -1; }while(ch < '0' || ch > '9'); do{ x = x * 10 + ch - '0'; ch = getchar(); }while(ch >= '0' && ch <= '9'); return f * x; } constint N = 1e5;
int n, m; structOpt { int type, x, y; inlinebooloperator <(const Opt a) const { return x == a.x?(y == a.y?type < a.type:y < a.y):x < a.x; } } opt[N * 2 + 1]; namespace BIT { int tr[N * 2 + 1]; inlineintlowbit(int x) { return x & (-x); } inlinevoidadd(int x) { int u = x;
while (u <= N * 2) { tr[u]++; u += lowbit(u); } return; } inlineintquery(int x) { if (!x) return0;
int ans = 0, u = x;
while (u) { ans += tr[u]; u -= lowbit(u); } return ans; } } int a[N * 2 + 1]; map<int, int> hhash; int del[N * 2 + 1], delh, tot; int ans[N + 1];
intmain() { n = read(); m = read(); for (int i = 1; i <= n; i++) { int x = read(), y = read(); opt[i] = { 0, x, y }; a[i] = y; } for (int i = 1; i <= m; i++) { int x = read(), y = read(); opt[n + i] = { i, x, y }; a[n + i] = y; } sort(opt + 1, opt + n + m + 1); sort(a + 1, a + n + m + 1); for (int i = 1; i <= n + m; i++) if (!hhash[a[i]]) hhash[a[i]] = ++tot;
int la = -1;
for (int i = 1; i <= n + m; i++) { if (!opt[i].type) { int d = delh - BIT::query(hhash[opt[i].y]); if (opt[i].x < opt[i].y + d) { if (!del[hhash[opt[i].y]]) { del[hhash[opt[i].y]] = 1; BIT::add(hhash[opt[i].y]); } } if (opt[i].x > opt[i].y + d) { if (la != opt[i].x) { la = opt[i].x; delh++; } } } else { if (!opt[i - 1].type && opt[i - 1].x == opt[i].x && opt[i - 1].y == opt[i].y) { ans[opt[i].type] = 1; } else { if (opt[i].x != la) { int d = delh - BIT::query(hhash[opt[i].y]); if (!del[hhash[opt[i].y]] && opt[i].x == opt[i].y + d) ans[opt[i].type] = 1; } } } }
for (int i = 1; i <= m; i++) printf("%s\n", ans[i]?"LOSE":"WIN"); return0; }