#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int t,n,m,r,s,f1[107],f2[107],p1[107],p2[107],fs,fr,p,f,r_;
bool st,removed[107],removed_[107];
void print()
{
for(int i=1; i<=n; i++)
{
cin >> f1[i];
}
for(int i=1; i<=n; i++)
{
cin >> p1[i];
}
for(int i=1; i<=n; i++)
{
cin >> f2[i];
}
for(int i=1; i<=n; i++)
{
cin >> p2[i];
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> t;
while(t--)
{
memset(removed,0,sizeof(removed));
memset(removed_,0,sizeof(removed_));
cin >> n >> m >> r >> s;
print();
fs=fr=n;
st=1;
while(fs&&fr)
{
p=0;
if(s==1)
{
if(st)
{
for(int i=1; i<=n; i++)
{
if(removed[i])
{
continue;
}
if(p1[i]<p1[p]||(p1[i]==p1[p]&&f1[i]<f1[p]))
{
p=i;
}
}
f=f1[p],r_=p1[p];
removed[p]=1;
fs--;
st=0;
}
else
{
for(int i=1; i<=n; i++)
{
if(removed[i])
{
continue;
}
if(f1[i]==f&&p1[i]>r_&&p1[i]<p1[p])
{
p=i;
}
}
if(!p)
{
st=1;
s=2;
continue;
}
f=f1[p],r_=p1[p];
removed[p]=1;
fs--;
}
s=2;
}
else
{
if(st)
{
for(int i=1; i<=n; i++)
{
if(removed_[i])
{
continue;
}
if(p2[i]<p2[p]||(p2[i]==p2[p]&&f2[i]<f2[p]))
{
p=i;
}
}
f=f2[p],r_=p2[p];
removed_[p]=1;
fr--;
st=0;
}
else
{
for(int i=1; i<=n; i++)
{
if(removed_[i])
{
continue;
}
if(f2[i]==f&&p2[i]>r_&&p2[i]<p2[p])
{
p=i;
}
}
if(!p)
{
st=1;
s=1;
continue;
}
f=f2[p],r_=p2[p];
removed_[p]=1;
fr--;
}
s=1;
}
}
if(!fs)
{
cout<<"FS wins!" << endl;
}
else
{
cout<<"FR wins!" << endl;;
}
}
return 0;
}