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.
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fucking interest
*******************************
Higher, higher, even higher, to the point you won’t even be able to see me
https://www.a2oj.com/Ladder16.html
*******************************
300IQ as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x1092C
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         String[] arr = new String[2*N-2];
         String[] one = new String[N];
         String[] two = new String[N];
         Arrays.fill(one, "@");
         for(int i=0; i < 2*N-2; i++)
         {
            String input = infile.readLine();
            int len = input.length();
            if(one[len].charAt(0) == '@')
               one[len] = input;
            else
               two[len] = input;
            arr[i] = input;
         }
         if(N == 2)
         {
            System.out.println("PS");
            return;
         }
         res = new int[N];
         //solve
         String template = "???";
         if(works(one[1], two[N-1], one, two))
            template = one[1]+two[N-1];
         else if(works(one[N-1], two[1], one, two))
            template = one[N-1]+two[1];
         else if(works(two[N-1], one[1], one, two))
            template = two[N-1]+one[1];
         else if(works(two[1], one[N-1], one, two))
            template = two[1]+one[N-1];
         else if(works(one[1], one[N-1], one, two));
         else if(works(two[1], two[N-1], one, two));
         else if(works(one[N-1], one[1], one, two));
         else if(works(two[N-1], two[1], one, two));
         else
         {
            System.out.println("wtf");
            return;
         }
         StringBuilder sb = new StringBuilder();
         char[] answer = new char[2*N-2];
         Arrays.fill(answer, '?');
         HashSet<String> seen = new HashSet<String>();
         for(int i=0; i < 2*N-2; i++)
         {
            int len = arr[i].length();
            if(arr[i].equals(one[len]))
            {
               if(arr[i].equals(two[len]))
               {
                  char c = 'P';
                  if(seen.contains(arr[i]))
                     c = 'S';
                  answer[i] = c;
               }
               else
               {
                  char c = 'P';
                  if(res[len] == 1)
                     c = 'S';
                  answer[i] = c;
               }
            }
            else
            {
               char c = 'S';
               if(res[len] == 1)
                  c = 'P';
               answer[i] = c;
            }
            seen.add(arr[i]);
         }
         System.out.println(answer);
      }
      static int[] res;
      public static boolean works(String aa, String bb, String[] one, String[] two)
      {
         Arrays.fill(res, 0);
         String template = aa+bb;
         HashMap<String, Integer> map1 = new HashMap<String, Integer>();
         for(String s: one)
            push(map1, s);
         HashMap<String, Integer> map2 = new HashMap<String, Integer>();
         for(String s: two)
            push(map2, s);
         String pref = "";
         int N = template.length();
         for(int i=0; i < N-1; i++)
         {
            pref += template.charAt(i);
            if(!map1.containsKey(pref))
            {
               if(!map2.containsKey(pref))
                  return false;
               pull(map2, pref);
               res[pref.length()] = 1; //two is prefix
            }
            else
               pull(map1, pref);
         }
         String suff = "";
         for(int i=N-1; i >= 1; i--)
         {
            suff = template.substring(i, N);
            if(!map1.containsKey(suff))
            {
               if(!map2.containsKey(suff))
                  return false;
               pull(map2, suff);
            }
            else
            {
               res[suff.length()] = 1; //one is suffix
               pull(map1, suff);
            }
         }  
         return true;
      }
      public static void push(HashMap<String, Integer> map, String k)
      {
         if(!map.containsKey(k))
            map.put(k, 0);
         map.put(k, map.get(k)+1);
      }
      public static void pull(HashMap<String, Integer> map, String k)
      {
         map.put(k, map.get(k)-1);
         if(map.get(k) == 0)
            map.remove(k);
      }
   }