Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. 

You don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes of lengths from 1 to n-1), but he didn't tell you which strings are prefixes and which are suffixes.

Ivan wants you to guess which of the given 2n-2 strings are prefixes of the given string and which are suffixes. It may be impossible to guess the string Ivan picked (since multiple strings may give the same set of suffixes and prefixes), but Ivan will accept your answer if there is at least one string that is consistent with it. Let the game begin!

Input

The first line of the input contains one integer number n (2 ≤ n ≤ 100) — the length of the guessed string s.

The next 2n-2 lines are contain prefixes and suffixes, one per line. Each of them is the string of length from 1 to n-1 consisting only of lowercase Latin letters. They can be given in arbitrary order.

It is guaranteed that there are exactly 2 strings of each length from 1 to n-1. It is also guaranteed that these strings are prefixes and suffixes of some existing string of length n.

Output

Print one string of length 2n-2 — the string consisting only of characters 'P' and 'S'. The number of characters 'P' should be equal to the number of characters 'S'. The i-th character of this string should be 'P' if the i-th of the input strings is the prefix and 'S' otherwise.

If there are several possible answers, you can print any.

Examples

Input


5
ba
a
abab
a
aba
baba
ab
aba


Output


SPPSPSPS


Input


3
a
aa
aa
a


Output


PPSS


Input


2
a
c


Output


PS

Note

The only string which Ivan can guess in the first example is "ababa".

The only string which Ivan can guess in the second example is "aaa". Answers "SPSP", "SSPP" and "PSPS" are also acceptable.

In the third example Ivan can guess the string "ac" or the string "ca". The answer "SP" is also acceptable.
import java.io.*;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        Main mm = new Main();
        mm.problemC(new Input(new BufferedReader(new InputStreamReader(System.in))), out);
        out.close();
    }

    static boolean check(int[] a,int l,int r){
        if((r-l)%2!=0)return false;
        if(r==l)return true;
        int al=a[l];
        int ll=l;
        while(a[ll]==al)ll++;
        int ar=a[r-1];
        int rr=r-1;
        while(a[rr]==ar)rr--;
        if(al>ar){
            if((ll-l)%2!=0) return false;
            return check(a,ll,r);
        }
        if(ar>al){
            if((r-rr-1)%2!=0) return false;
            return check(a,l,rr+1);
        }
        if(ar==al){
            if(ll==r)return true;
            return check(a,ll,rr+1);
        }
        return true;
    }

    static void problemD2(Input in, PrintWriter out) throws IOException {
        int n=in.nextInt();
        int[] a=new int[n+2];
        int mx=0;
        for (int i = 1; i <= n; i++) {
            a[i]=in.nextInt();
            if(a[i]>mx)mx=a[i];
        }
        a[0]=mx;
        a[n+1]=mx;
        int k=0;
        for (int i = 1; i <= n+1; i++) {
            if(a[i]==mx){
                if(!check(a,k+1,i)){
                    out.println("NO");
                    return;
                }
                k=i;
            }
        }
        out.println("YES");

    }

    static void problemC(Input in, PrintWriter out) throws IOException {
        int n=in.nextInt();
        if(n==2){
            in.next();in.next();
            out.println("PS");
            return;
        }
        String[] ss=new String[2*n-2];
        String s1="",s2="",s3="",s4="";
        for (int i = 0; i < 2 * n - 2; i++) {
            ss[i]=in.next();
            if(ss[i].length()==n-1){
                if(s1.isEmpty())s1=ss[i];
                else s2=ss[i];
            }
            if(ss[i].length()==n-2){
                if(s3.isEmpty())s3=ss[i];
                else s4=ss[i];
            }
        }
        String s5="",s6="";
        if (s2.startsWith(s1.substring(1)))s5=s1.substring(0,1)+s2;
        if (s1.startsWith(s2.substring(1)))s6=s2.substring(0,1)+s1;
        if(!s5.isEmpty()&&!s6.isEmpty()) {
            if( (s5.startsWith(s3)&&s5.endsWith(s4))||(s5.startsWith(s4)&&s5.endsWith(s3)) )  s6="";
            else s5="";
        }
        String s=s5.isEmpty()?s6:s5;
        char[] a=new char[n];
        for (int i = 0; i < 2*n-2; i++) {
            if(a[ss[i].length()]==0){
                if(s.startsWith(ss[i])){
                    a[ss[i].length()]='S';
                    out.print('P');
                }else{
                    a[ss[i].length()]='P';
                    out.print('S');
                }
            }else
                out.print(a[ss[i].length()]);
        }
        out.println();
    }

    static void problemB(Input in, PrintWriter out) throws IOException {
        int n=in.nextInt();
        int[] a=new int[n];
        for (int i = 0; i < n; i++) {
            a[i]=in.nextInt();
        }
        Arrays.sort(a);
        int k=0;
        for (int i = 0; i < n/2; i++) {
            k+=a[2*i+1]-a[2*i];
        }
        out.println(k);
    }

    static void problemA(Input in, PrintWriter out) throws IOException {
        int t=in.nextInt();
        for (; t > 0; t--) {
            int n=in.nextInt(),k=in.nextInt();
            char c='a';
            for (int i = 0; i < k; i++) {
                for (int j = 0; j < n / k; j++) {
                    out.print(c);
                }
                c++;
            }
            for (int j = 0; j < n % k; j++) {
                out.print('a');
            }
            out.println();
        }
    }

    static class Input {
        BufferedReader in;
        StringBuilder sb = new StringBuilder();

        public Input(BufferedReader in) {
            this.in = in;
        }

        public Input(String s) {
            this.in = new BufferedReader(new StringReader(s));
        }

        public String next() throws IOException {
            sb.setLength(0);
            while (true) {
                int c = in.read();
                if (c == -1) {
                    return null;
                }
                if (" \n\r\t".indexOf(c) == -1) {
                    sb.append((char) c);
                    break;
                }
            }
            while (true) {
                int c = in.read();
                if (c == -1 || " \n\r\t".indexOf(c) != -1) {
                    break;
                }
                sb.append((char) c);
            }
            return sb.toString();
        }

        public char nextChar() throws IOException {
            while (true) {
                int c = in.read();
                if (c == -1) {
                    return (char)c;
                }
                if (" \n\r\t".indexOf(c) == -1) {
                    return (char)c;
                }
            }
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}