#include<stdio.h>
#include<cstring>
#include<cstdio>
using namespace std;
struct Point
{
int x,y;
};
#include<cstring>
#include<cstdio>
using namespace std;
struct Point
{
int x,y;
};
const int MAXN = 1000+100;
int parent[MAXN];
int N,d;
Point p[MAXN];
bool isrep[MAXN];
int parent[MAXN];
int N,d;
Point p[MAXN];
bool isrep[MAXN];
void make_set()
{
for(int i = 0;i <= N;i++)
{
parent[i] = i;
isrep[i] = false;
}
}
{
for(int i = 0;i <= N;i++)
{
parent[i] = i;
isrep[i] = false;
}
}
int find_set(int t);
bool isIn(Point a,Point b)
{
int dd = (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
if(dd <= d*d) return true;
return false;
}
bool isIn(Point a,Point b)
{
int dd = (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
if(dd <= d*d) return true;
return false;
}
int main()
{
scanf("%d%d",&N,&d);
for(int i = 1;i <= N;i++)
{
scanf("%d%d",&p[i].x,&p[i].y);
}
{
scanf("%d%d",&N,&d);
for(int i = 1;i <= N;i++)
{
scanf("%d%d",&p[i].x,&p[i].y);
}
char op;
int a,b;
make_set();
while(cin>>op)
{
if(op == 's')
{
scanf("%d%d",&a,&b);
if(find_set(parent[a]) == find_set(parent[b]))
printf("SUCCESS\n");
else printf("FAIL\n");
}
else
{
scanf("%d",&a);
for(int j = 1;j <= N;j++)
{
if(isrep[j])
{
if(isIn(p[a],p[j]))
union_set(a,j);
}
}
isrep[a] = ture;
}
}
}
int find_set(int t)
{
int t1 = find_set(a);
int t2 = find_set(b);
if(t1 != t2)
{
parent[t2] = t1;
}
}
int a,b;
make_set();
while(cin>>op)
{
if(op == 's')
{
scanf("%d%d",&a,&b);
if(find_set(parent[a]) == find_set(parent[b]))
printf("SUCCESS\n");
else printf("FAIL\n");
}
else
{
scanf("%d",&a);
for(int j = 1;j <= N;j++)
{
if(isrep[j])
{
if(isIn(p[a],p[j]))
union_set(a,j);
}
}
isrep[a] = ture;
}
}
}
int find_set(int t)
{
int t1 = find_set(a);
int t2 = find_set(b);
if(t1 != t2)
{
parent[t2] = t1;
}
}