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.util.*;
import java.io.*;

public class C {

	static final boolean stdin = true;
	static final String filename = "";
	static FastScanner br;
	static PrintWriter pw;

	public static void main(String[] args) throws IOException {

		if (stdin) {
			br = new FastScanner();
			pw = new PrintWriter(new OutputStreamWriter(System.out));
		} else {
			br = new FastScanner(filename + ".in");
			pw = new PrintWriter(new FileWriter(filename + ".out"));
		}

		Solver solver = new Solver();
		solver.solve(br, pw);
		pw.close();
	}

	static class Solver {
		static long mod = (long) (1e9);

		public void solve(FastScanner br, PrintWriter pw) throws IOException {
			int n = br.ni();
			Point[] in = new Point[2 * n - 2];
			for (int i = 0; i < 2 * n - 2; i++) {
				in[i] = new Point(br.nt(), i);
			}
			Arrays.sort(in);
			String s1 = in[in.length - 1].a;
			String s2 = in[in.length - 2].a;
			// try s1 pref and s2 suf
			boolean[] pref = new boolean[2 * n - 2];
			pref[in[in.length - 1].b] = true;
			pref[in[in.length - 2].b] = false;
			String main = s1 + s2.charAt(s2.length() - 1);
			boolean FAIL = false;
			for (int i = 0; i < 2 * n - 4; i+=2) {
				if (in[i].a.equals(main.substring(0, in[i].a.length()))) {
					if (in[i + 1].a.equals(main.substring(main.length() - in[i + 1].a.length()))) {
						pref[in[i].b] = true;
						pref[in[i + 1].b] = false;
					} else {
						FAIL = true;
						break;
					}
				} else if (in[i].a.equals(main.substring(main.length() - in[i].a.length()))) {
					if (in[i + 1].a.equals(main.substring(0, in[i + 1].a.length()))) {
						pref[in[i].b] = false;
						pref[in[i + 1].b] = true;
					} else {
						FAIL = true;
						break;
					}
				} else {
					FAIL = true;
					break;
				}
			}
			if (FAIL) {
				// try s2 pref and s1 suf
				pref = new boolean[2 * n - 2];
				pref[in[in.length - 1].b] = false;
				pref[in[in.length - 2].b] = true;
				main = s2 + s1.charAt(s1.length() - 1);
				for (int i = 0; i < 2 * n - 4; i+=2) {
					if (in[i].a.equals(main.substring(0, in[i].a.length()))) {
						if (in[i + 1].a.equals(main.substring(main.length() - in[i + 1].a.length()))) {
							pref[in[i].b] = true;
							pref[in[i + 1].b] = false;
						}
					} else if (in[i].a.equals(main.substring(main.length() - in[i].a.length()))) {
						if (in[i + 1].a.equals(main.substring(0, in[i + 1].a.length()))) {
							pref[in[i].b] = false;
							pref[in[i + 1].b] = true;
						}
					}
				}

				for (boolean b : pref) {
					if (b)
						pw.print("P");
					else
						pw.print("S");
				}
			} else {
				for (boolean b : pref) {
					if (b)
						pw.print("P");
					else
						pw.print("S");
				}
			}
//			pw.println();
//			
//			for (Point p : in) {
//				pw.println(p.a);
//			}
		}

		static long gcd(long a, long b) {
			if (a > b)
				return gcd(b, a);
			if (a == 0)
				return b;
			return gcd(b % a, a);
		}

		static long lcm(long a, long b) {
			return a * (b / gcd(a, b));
		}

		static long pow(long a, long b) {
			if (b == 0)
				return 1L;
			long val = pow(a, b / 2);
			if (b % 2 == 0)
				return val * val % mod;
			else
				return val * val % mod * a % mod;
		}

	}

	static class Point implements Comparable<Point> {
		String a;
		int b;

		Point(String a, int b) {
			this.a = a;
			this.b = b;
		}

		@Override
		public int compareTo(Point o) {
			return this.a.length() - o.a.length();
		}

		public boolean equals(Object obj) {
			if (obj instanceof Point) {
				Point other = (Point) obj;
				return a == other.a && b == other.b;
			}
			return false;
		}

		// public int hashCode() {
		// return 65536 * a + b + 4733 * 0;
		// }

	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		ArrayList<Integer>[] ng(int n, int e) {
			ArrayList<Integer>[] adj = new ArrayList[n];
			for (int i = 0; i < n; i++) {
				adj[i] = new ArrayList<Integer>();
			}
			for (int i = 0; i < e; i++) {
				int a = ni() - 1;
				int b = ni() - 1;
				adj[a].add(b);
				adj[b].add(a);
			}
			return adj;
		}

		Integer[] nIa(int n) {
			Integer[] arr = new Integer[n];
			for (int i = 0; i < n; i++) {
				arr[i] = ni();
			}
			return arr;
		}

		int[] nia(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = ni();
			}
			return arr;
		}

		Long[] nLa(int n) {
			Long[] arr = new Long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nl();
			}
			return arr;
		}

		long[] nla(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nl();
			}
			return arr;
		}

		String[] nsa(int n) {
			String[] arr = new String[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nt();
			}
			return arr;
		}

		String nt() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int ni() {
			return Integer.parseInt(nt());
		}

		long nl() {
			return Long.parseLong(nt());
		}

		double nd() {
			return Double.parseDouble(nt());
		}

	}
}