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.
/*
   @author :: Abhimanyu Chauhan 
*/


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public class TaskC implements Runnable{
    
    public void solve(){
        int n = scan.nextInt();
        String ar[]  = new String[2*n-2];
        String x="",y="";
        for(int i=0;i<2*n-2;i++){
            ar[i] = scan.next();
            if(ar[i].length()==n-1){
                if(x.isEmpty())
                x = ar[i];
                else
                y = ar[i];
            }
        }
        String res1 = "";
        if(x.substring(1).equals(y.substring(0,n-2))){
            res1 = x+y.charAt(n-2)+"";
        }
        String res2 = "";
        
        if(y.substring(1).equals(x.substring(0,n-2))){
            res2 = y+x.charAt(n-2)+"";
        }
        // Arrays.sort(ar);
        char ans[] = new char[2*n-2];
        boolean c[] = new boolean[2*n-2];
        // out.pritnln(res1+ " "+res2);
        //res1:
        int count =0;
        //[prefix]
        boolean found = false;
        if(res1.length()!=0){
            int len[] = new int[n+100];
            for(int i=0;i<n;i++){
                String s = res1.substring(0,i);
                for(int j =0;j<2*n-2;j++){
                    if(ar[j].equals(s) && c[j]==false&& count<n-1 && len[s.length()]==0){
                        c[j] = true;
                        ans[j] = 'P';
                        count++;
                        len[s.length()]++;
                    }
                }
            }
            //[suffix]
            len = new int[n+100];
            count = 0;
            for(int i=1;i<n;i++){
                String s = res1.substring(i,n);
                for(int j =0;j<2*n-2;j++){
                    if(ar[j].equals(s) && c[j]==false&& count<n-1 && len[s.length()]==0){
                        c[j] = true;
                        ans[j] = 'S';
                        count++;
                        len[s.length()]++;
                    }
                }
            }
            for(int i=0;i<2*n-2;i++){
                if(c[i]==false){
                    found = true;
                    break;
                }
            }
           
            if(!found){
                out.println(String.valueOf(ans));
            }
            // out.println(found);/
        }
        if(found || res1.length()==0){
            //res2:
                //[prefix]
                int len[] = new int[n+100];
                c = new boolean[2*n-2];
                ans = new char[2*n-2];
                count = 0;
                for(int i=0;i<n;i++){
                    String s = res2.substring(0,i);
                    for(int j =0;j<2*n-2;j++){
                        if(ar[j].equals(s)&& c[j]==false && count<n-1 && len[s.length()]==0){
                            c[j] = true;
                            ans[j] = 'P';
                            count++;
                            len[s.length()]++;
                        }
                    }
                }
                //[suffix]
                len = new int[n+100];
                count = 0;
                for(int i=1;i<n;i++){
                    String s = res2.substring(i,n);
                    for(int j =0;j<2*n-2;j++){
                        if(ar[j].equals(s)&& c[j]==false && count<n-1 && len[s.length()]==0){
                            c[j] = true;
                            ans[j] = 'S';
                            count++;
                            len[s.length()]++;
                        }
                    }
                }
                out.println(String.valueOf(ans));
        }
        
    }
    
    InputReader scan;
    PrintWriter out;
    
    @Override
    public void run(){
        scan = new InputReader(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.flush();
        out.close();
    }
    
    public static void main(String[] args) {
        new Thread(null,new TaskC(),"Main",1<<26).start();
    }
    
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }
        
        public int read() {
            if (numChars==-1) 
                throw new InputMismatchException();
            
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }
                
                if(numChars <= 0)               
                    return -1;
            }
            return buf[curChar++];
        }
     
        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();
            
            while(isSpaceChar(c)) 
                c = read();
            
            int sgn = 1;
            
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            
            int res = 0;
            do {
                if(c<'0'||c>'9') 
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c)); 
            
            return res * sgn;
        }
        
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }
        
        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        
        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } 
            while (!isSpaceChar(c));
            
            return res.toString();
        }
     
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
     
        public String next() {
            return readString();
        }
        
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}