#include <bits/stdc++.h>
#define fu(i,a,b) for(int i=a; i<=b; i++)
#define fd(i,a,b) for(int i=a; i>=b; i--)
#define X first
#define Y second
#define mtp make_tuple
#define pro "huda"
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<string,int> si;
const int maxN = 105;
const long long oo = ll(1e17)+7;
template <typename T> inline void read(T &x)
{
x=0;
char c;
while (!isdigit(c=getchar()));
do x=x*10+c-'0';
while (isdigit(c=getchar()));
}
template <typename T> inline void write(T x)
{
if (x>9) write(x/10);
putchar(x%10+48);
}
int n;
pair<string,int> s[2*maxN];
string suf[maxN],pre[maxN],rs[2*maxN];
bool cmp(si a, si b)
{
return (a.X.length()>=b.X.length());
}
void suybien()
{
suf[n-1]=s[2].X;
pre[n-1]=s[1].X;
rs[s[2].Y]="S";
rs[s[1].Y]="P";
for(int i=3; i<=2*n-2; i+=2)
{
bool kt1=1,kt2=1;
int l=s[i].X.length();
///bug(s[i],l,suf[l+1]);
for(int j=0; j<=l-1; j++)
if (s[i].X[j]!=suf[l+1][j+1])
{
kt1=0;
break;
}
for(int j=0; j<=l-1; j++)
if (s[i+1].X[j]!=pre[l+1][j])
{
kt2=0;
break;
}
if ((kt1&&kt2))
{
suf[l]=s[i].X;
pre[l]=s[i+1].X;
rs[s[i].Y]="S";
rs[s[i+1].Y]="P";
} else
{
suf[l]=s[i+1].X;
pre[l]=s[i].X;
rs[s[i+1].Y]="S";
rs[s[i].Y]="P";
}
}
fu(i,1,2*n-2) cout << rs[i];
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen(pro".inp","r",stdin);
freopen(pro".out","w",stdout);
#endif
cin >> n;
fu(i,1,2*n-2)
{
string _s;
cin >> _s;
s[i]={_s,i};
}
sort(s+1,s+2*n-1,&cmp);
suf[n-1]=s[1].X;
pre[n-1]=s[2].X;
rs[s[1].Y]="S";
rs[s[2].Y]="P";
///bug1D(s,1,2*n-2);
for(int i=3; i<=2*n-2; i+=2)
{
bool kt1=1,kt2=1,kt3=1,kt4=1;
int l=s[i].X.length();
///bug(s[i],l,suf[l+1]);
for(int j=0; j<=l-1; j++)
if (s[i].X[j]!=suf[l+1][j+1])
{
kt1=0;
break;
}
for(int j=0; j<=l-1; j++)
if (s[i+1].X[j]!=pre[l+1][j])
{
kt2=0;
break;
}
///
for(int j=0; j<=l-1; j++)
if (s[i+1].X[j]!=suf[l+1][j+1])
{
kt3=0;
break;
}
for(int j=0; j<=l-1; j++)
if (s[i].X[j]!=pre[l+1][j])
{
kt4=0;
break;
}
if ((kt1&&kt2))
{
suf[l]=s[i].X;
pre[l]=s[i+1].X;
rs[s[i].Y]="S";
rs[s[i+1].Y]="P";
} else
{
if (kt3&&kt4)
{
suf[l]=s[i+1].X;
pre[l]=s[i].X;
rs[s[i+1].Y]="S";
rs[s[i].Y]="P";
} else
{
suybien();
exit(0);
}
}
}
fu(i,1,2*n-2) cout << rs[i];
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgZnUoaSxhLGIpIGZvcihpbnQgaT1hOyBpPD1iOyBpKyspCiNkZWZpbmUgZmQoaSxhLGIpIGZvcihpbnQgaT1hOyBpPj1iOyBpLS0pCiNkZWZpbmUgWCBmaXJzdAojZGVmaW5lIFkgc2Vjb25kCiNkZWZpbmUgbXRwIG1ha2VfdHVwbGUKI2RlZmluZSBwcm8gImh1ZGEiCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKdHlwZWRlZiBkb3VibGUgZGI7CnR5cGVkZWYgbG9uZyBkb3VibGUgbGRiOwp0eXBlZGVmIHBhaXI8aW50LGludD4gcGlpOwp0eXBlZGVmIHBhaXI8c3RyaW5nLGludD4gc2k7CmNvbnN0IGludCBtYXhOID0gMTA1Owpjb25zdCBsb25nIGxvbmcgb28gPSBsbCgxZTE3KSs3OwoKdGVtcGxhdGUgPHR5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bbCsxXVtqXSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAga3QyPTA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIGlmICgoa3QxJiZrdDIpKQogICAgICAgIHsKICAgICAgICAgICAgc3VmW2xdPXNbaV0uWDsKICAgICAgICAgICAgcHJlW2xdPXNbaSsxXS5YOwogICAgICAgICAgICByc1tzW2ldLlldPSJTIjsKICAgICAgICAgICAgcnNbc1tpKzFdLlldPSJQIjsKICAgICAgICB9IGVsc2UKICAgICAgICB7CiAgICAgICAgICAgIHN1ZltsXT1zW2krMV0uWDsKICAgICAgICAgICAgcHJlW2xdPXNbaV0uWDsKICAgICAgICAgICAgcnNbc1tpKzFdLlldPSJTIjsKICAgICAgICAgICAgcnNbc1tpXS5ZXT0iUCI7CiAgICAgICAgfQogICAgfQogICAgZnUoaSwxLDIqbi0yKSBjb3V0IDw8IHJzW2ldOwp9CgppbnQgbWFpbigpCnsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCk7CiAgICBjaW4udGllKDApOwogICAgY291dC50aWUoMCk7CiAgICAjaWZuZGVmIE9OTElORV9KVURHRQogICAgZnJlb3Blbihwcm8iLmlucCIsInIiLHN0ZGluKTsKICAgIGZyZW9wZW4ocHJvIi5vdXQiLCJ3IixzdGRvdXQpOwogICAgI2VuZGlmCiAgICBjaW4gPj4gbjsKICAgIGZ1KGksMSwyKm4tMikKICAgIHsKICAgICAgICBzdHJpbmcgX3M7CiAgICAgICAgY2luID4+IF9zOwogICAgICAgIHNbaV09e19zLGl9OwogICAgfQogICAgc29ydChzKzEscysyKm4tMSwmY21wKTsKICAgIHN1ZltuLTFdPXNbMV0uWDsKICAgIHByZVtuLTFdPXNbMl0uWDsKICAgIHJzW3NbMV0uWV09IlMiOwogICAgcnNbc1syXS5ZXT0iUCI7CiAgICAvLy9idWcxRChzLDEsMipuLTIpOwogICAgZm9yKGludCBpPTM7IGk8PTIqbi0yOyBpKz0yKQogICAgewogICAgICAgIGJvb2wga3QxPTEsa3QyPTEsa3QzPTEsa3Q0PTE7CiAgICAgICAgaW50IGw9c1tpXS5YLmxlbmd0aCgpOwogICAgICAgIC8vL2J1ZyhzW2ldLGwsc3VmW2wrMV0pOwogICAgICAgIGZvcihpbnQgaj0wOyBqPD1sLTE7IGorKykKICAgICAgICAgICAgaWYgKHNbaV0uWFtqXSE9c3VmW2wrMV1baisxXSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAga3QxPTA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIGZvcihpbnQgaj0wOyBqPD1sLTE7IGorKykKICAgICAgICAgICAgaWYgKHNbaSsxXS5YW2pdIT1wcmVbbCsxXVtqXSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAga3QyPTA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIC8vLwogICAgICAgIGZvcihpbnQgaj0wOyBqPD1sLTE7IGorKykKICAgICAgICAgICAgaWYgKHNbaSsxXS5YW2pdIT1zdWZbbCsxXVtqKzFdKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBrdDM9MDsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgZm9yKGludCBqPTA7IGo8PWwtMTsgaisrKQogICAgICAgICAgICBpZiAoc1tpXS5YW2pdIT1wcmVbbCsxXVtqXSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAga3Q0PTA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIGlmICgoa3QxJiZrdDIpKQogICAgICAgIHsKICAgICAgICAgICAgc3VmW2xdPXNbaV0uWDsKICAgICAgICAgICAgcHJlW2xdPXNbaSsxXS5YOwogICAgICAgICAgICByc1tzW2ldLlldPSJTIjsKICAgICAgICAgICAgcnNbc1tpKzFdLlldPSJQIjsKICAgICAgICB9IGVsc2UKICAgICAgICB7CiAgICAgICAgICAgIGlmIChrdDMmJmt0NCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc3VmW2xdPXNbaSsxXS5YOwogICAgICAgICAgICAgICAgcHJlW2xdPXNbaV0uWDsKICAgICAgICAgICAgICAgIHJzW3NbaSsxXS5ZXT0iUyI7CiAgICAgICAgICAgICAgICByc1tzW2ldLlldPSJQIjsKICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN1eWJpZW4oKTsKICAgICAgICAgICAgICAgIGV4aXQoMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBmdShpLDEsMipuLTIpIGNvdXQgPDwgcnNbaV07Cn0=