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.*;

public class ProblemC {

    public static InputStream inputStream = System.in;

    public static OutputStream outputStream = System.out;

    public static void main(String[] args) {
        MyScanner scanner = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int n = scanner.nextInt();
        List<String> list = new ArrayList<>();
        String str1 = null, str2 = null;
        for (int i = 0; i < 2 * n - 2; i++) {
            String s = scanner.next();
            if (s.length() == n - 1) {
                if (str1 == null) {
                    str1 = s;
                } else {
                    str2 = s;
                }
            }
            list.add(s);
        }

        Set<Integer> prefixes = new HashSet<>();
        Set<Integer> suffixes = new HashSet<>();

        StringBuilder stringBuilder = new StringBuilder();
        String str = str1 + str2.charAt(str2.length() - 1);
        boolean cant = false;
        for (int i = 0; i < 2 * n - 2; i++) {
            if (prefixes.contains(list.get(i).length())) {
                if (isSuffix(str, list.get(i))) {
                    stringBuilder.append("S");
                } else {
                    cant = true;
                    break;
                }
            } else if (suffixes.contains(list.get(i).length())) {
                if (isPrefix(str, list.get(i))) {
                    stringBuilder.append("P");
                } else {
                    cant = true;
                    break;
                }
            } else {
                if (isPrefix(str, list.get(i))) {
                    stringBuilder.append("P");
                    prefixes.add(list.get(i).length());
                } else {
                    stringBuilder.append("S");
                    suffixes.add(list.get(i).length());
                }
            }
        }

        if (cant) {
            str = str2 + str1.charAt(str1.length() - 1);
            prefixes.clear();
            suffixes.clear();
            stringBuilder = new StringBuilder();

            for (int i = 0; i < 2 * n - 2; i++) {
                if (prefixes.contains(list.get(i).length())) {
                    if (isSuffix(str, list.get(i))) {
                        stringBuilder.append("S");
                    }
                } else if (suffixes.contains(list.get(i).length())) {
                    if (isPrefix(str, list.get(i))) {
                        stringBuilder.append("P");
                    }
                } else {
                    if (isPrefix(str, list.get(i))) {
                        stringBuilder.append("P");
                        prefixes.add(list.get(i).length());
                    } else {
                        stringBuilder.append("S");
                        suffixes.add(list.get(i).length());
                    }
                }
            }

            out.println(stringBuilder.toString());
        } else {
            out.println(stringBuilder.toString());
        }



        out.flush();
    }

    private static boolean isPrefix(String str, String prefix) {
        for (int i = 0; i < prefix.length(); i++) {
            if (str.charAt(i) != prefix.charAt(i)) {
                return false;
            }
        }
        return true;
    }

    private static boolean isSuffix(String str, String suffix) {
        for (int i = suffix.length() - 1; i >= 0; i--) {
            if (str.charAt(i + (str.length() - suffix.length())) != suffix.charAt(i)) {
                return false;
            }
        }
        return true;
    }

    private static class MyScanner {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        private MyScanner(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private String next() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private double nextDouble() {
            return Double.parseDouble(next());
        }

        private String nextLine() {
            String str = "";
            try {
                str = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    private static class Pair<F, S> {

        private F first;

        private S second;

        public Pair() {}

        public Pair(F first, S second) {
            this.first = first;
            this.second = second;
        }
    }
}
