#include<iostream>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
struct point
{
int x;
int y;
int index;
}point[2000];
int pre[2000];
int mark[2000];
int n,d;
int num[10000];
int find(int x)
{
return x==pre[x]?x:pre[x]=find(pre[x]);
// find 函数
}
void unions(int x,int y)
{
int fx=find(x);
int fy=find(y);
if(fx!=fy)
{
pre[fx]=fy;
}
//union函数
}//并查集方法;
double dis(int x,int y)
{
double x1=(point[x].x-point[y].x)*(point[x].x-point[y].x)+(point[x].y-point[y].y)*(point[x].y-point[y].y);
return sqrt(x1);
}
int main()
{
cin>>n>>d;
for(int i=1;i<=n;i++){
pre[i]=i;//初始化函数
cin>>point[i].x>>point[i].y;
//point[i].index=i;
}
char str;
int b,c;
int i=0;
while(cin>>str){
if(str=='O')
{
cin>>num[++i];//编号联通
int s=num[i];
mark[s]=1;
for(int t=1;i<=i;t++){
if(mark[t]==1&&t!=s&&dis(t,s)<=d)
{
unions(s,t);
}
}
}
else{
cin>>b>>c;
if(find(pre[b])==find(pre[c])){
cout<<"SUCCESS"<<endl;
}else {
cout<<"FAIL"<<endl;
}
}
}
return 0;
}