#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?:a:b)
#define ll long long
#define N 1000000010
//#define file
using namespace std;

struct type{int x,y,id;} b[200011];
struct Type{int x,y;} s;
int n,m,i,j,k,l,tot,ls,mx,Add;
bool ans[100001];
set<Type> st;
set<Type> :: iterator I;

bool cmp(type a,type b) {return a.x<b.x || a.x==b.x && a.y<b.y || a.x==b.x && a.y==b.y && a.id<b.id;}
bool operator < (Type a,Type b) {return a.x<b.x;}
void add(int t)
{
	I=st.upper_bound(Type{t,0});
	if (I==st.begin()) return;
	--I;s=*I;
	if (s.x<=t && t<=s.y)
	{
		st.erase(I);
		if (s.x<t) st.insert(Type{s.x,t-1});
		if (t<s.y) st.insert(Type{t+1,s.y});
	}
}

int main()
{
	#ifdef file
	freopen("CF1458E.in","r",stdin);
	freopen("CF1458E.out","w",stdout);
	#endif
	
	scanf("%d%d",&n,&m);tot=n+m;
	fo(i,1,n) scanf("%d%d",&b[i].x,&b[i].y);
	fo(i,n+1,n+m) scanf("%d%d",&b[i].x,&b[i].y),b[i].id=i-n;
	
	st.insert(Type{0,N});
	sort(b+1,b+tot+1,cmp);ls=0;b[0].x=-1;
	fo(i,1,tot)
	if (i==tot || b[i].x!=b[i+1].x)
	{
		l=b[i].x-b[ls].x-1;
		while (l)
		{
			s=*st.begin(),st.erase(s);
			if (s.y-s.x+1<=l) l-=s.y-s.x+1;
			else {st.insert(Type{s.x+l,s.y});l=0; break;}
		}
		Add=(*st.begin()).x;
		fo(j,ls+1,i) if (!b[j].id && b[j].y<=Add) {Add=-1;break;}
		if (Add>-1) add(Add);
		
		mx=-1;
		fo(j,ls+1,i)
		if (!b[j].id)
		mx=max(mx,b[j].y),add(b[j].y);
		else
		{
			if (mx>-1) ans[b[j].id]=mx<b[j].y;
			else ans[b[j].id]=b[j].y!=Add;
		}
		ls=i;
	}
	fo(i,1,m) printf(ans[i]?"WIN\n":"LOSE\n");
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}
### Prompt

Generate a CPP solution to the following problem:

After your debut mobile game "Nim" blew up, you decided to make a sequel called "Nim 2". This game will expand on the trusted Nim game formula, adding the much awaited second heap! 

In the game, there are two heaps, each containing a non-negative number of stones. Two players make moves in turn. On their turn, a player can take any positive number of stones from either one of the heaps. A player who is unable to move loses the game.

To make the game easier to playtest, you've introduced developer shortcuts. There are n shortcut positions (x_1, y_1), …, (x_n, y_n). These change the game as follows: suppose that before a player's turn the first and second heap contain x and y stones respectively. If the pair (x, y) is equal to one of the pairs (x_i, y_i), then the player about to move loses instantly, otherwise they are able to make moves as normal. Note that in the above explanation the two heaps and all pairs are ordered, that is, x must refer to the size of the first heap, and y must refer to the size of the second heap.

The game release was followed by too much celebration, and next thing you know is developer shortcuts made their way to the next official update of the game! Players now complain that the AI opponent has become unbeatable at certain stages of the game. You now have to write a program to figure out which of the given initial positions can be won by the starting player, assuming both players act optimally.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 10^5) — the number of shortcut positions, and the number of initial positions that need to be evaluated.

The following n lines describe shortcut positions. The i-th of these lines contains two integers x_i, y_i (0 ≤ x_i, y_i ≤ 10^9). It is guaranteed that all shortcut positions are distinct.

The following m lines describe initial positions. The i-th of these lines contains two integers a_i, b_i (0 ≤ a_i, b_i ≤ 10^9) — the number of stones in the first and second heap respectively. It is guaranteed that all initial positions are distinct. However, initial positions are not necessarily distinct from shortcut positions.

Output

For each initial position, on a separate line print "WIN" if the starting player is able to win from this position, and "LOSE" otherwise.

Example

Input


3 5
3 0
0 1
2 2
0 0
1 1
2 2
3 3
5 4


Output


LOSE
WIN
LOSE
WIN
LOSE

### Response

```cpp
#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?:a:b)
#define ll long long
#define N 1000000010
//#define file
using namespace std;

struct type{int x,y,id;} b[200011];
struct Type{int x,y;} s;
int n,m,i,j,k,l,tot,ls,mx,Add;
bool ans[100001];
set<Type> st;
set<Type> :: iterator I;

bool cmp(type a,type b) {return a.x<b.x || a.x==b.x && a.y<b.y || a.x==b.x && a.y==b.y && a.id<b.id;}
bool operator < (Type a,Type b) {return a.x<b.x;}
void add(int t)
{
	I=st.upper_bound(Type{t,0});
	if (I==st.begin()) return;
	--I;s=*I;
	if (s.x<=t && t<=s.y)
	{
		st.erase(I);
		if (s.x<t) st.insert(Type{s.x,t-1});
		if (t<s.y) st.insert(Type{t+1,s.y});
	}
}

int main()
{
	#ifdef file
	freopen("CF1458E.in","r",stdin);
	freopen("CF1458E.out","w",stdout);
	#endif
	
	scanf("%d%d",&n,&m);tot=n+m;
	fo(i,1,n) scanf("%d%d",&b[i].x,&b[i].y);
	fo(i,n+1,n+m) scanf("%d%d",&b[i].x,&b[i].y),b[i].id=i-n;
	
	st.insert(Type{0,N});
	sort(b+1,b+tot+1,cmp);ls=0;b[0].x=-1;
	fo(i,1,tot)
	if (i==tot || b[i].x!=b[i+1].x)
	{
		l=b[i].x-b[ls].x-1;
		while (l)
		{
			s=*st.begin(),st.erase(s);
			if (s.y-s.x+1<=l) l-=s.y-s.x+1;
			else {st.insert(Type{s.x+l,s.y});l=0; break;}
		}
		Add=(*st.begin()).x;
		fo(j,ls+1,i) if (!b[j].id && b[j].y<=Add) {Add=-1;break;}
		if (Add>-1) add(Add);
		
		mx=-1;
		fo(j,ls+1,i)
		if (!b[j].id)
		mx=max(mx,b[j].y),add(b[j].y);
		else
		{
			if (mx>-1) ans[b[j].id]=mx<b[j].y;
			else ans[b[j].id]=b[j].y!=Add;
		}
		ls=i;
	}
	fo(i,1,m) printf(ans[i]?"WIN\n":"LOSE\n");
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}
```