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

public class temp1 {

	public static PrintWriter out;
	static int o = 0, e = 0;
	static long[] fa;
	static int[][][][] dp;
	static ArrayList<Integer>[] a;
	static int ans = 0;
	static HashMap<Long, Integer> hm = new HashMap<>();
	static StringBuilder sb = new StringBuilder();

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

		// Reader scn = new Reader();
		Scanner scn = new Scanner(System.in);

		int n = scn.nextInt();

		ArrayList<String> p = new ArrayList<>();
		ArrayList<String> l = new ArrayList<>();

		for (int i = 1; i <= 2 * n - 2; i++) {

			String s = scn.next();
			p.add(s);

			if (s.length() == n - 1)
				l.add(s);
		}

		StringBuilder sb = f(l.get(0), l.get(1), p);

		if (sb.length() != 0) {
			System.out.println(sb);
			return;
		}

		sb = f(l.get(1), l.get(0), p);

		System.out.println(sb);

	}

	private static StringBuilder f(String pre, String su, ArrayList<String> p) {

		StringBuilder ans = new StringBuilder();

		if (!pre.substring(1).equals(su.substring(0, su.length() - 1)))
			return ans;

		HashSet<String> hm1 = new HashSet<>();
		HashSet<String> hm2 = new HashSet<>();

		String temp = "";

		for (char ch : pre.toCharArray()) {
			temp += ch;
			hm1.add(temp);
		}

		temp = "";

		for (int i = su.length() - 1; i >= 0; i--) {

			temp = su.charAt(i)+temp;
			hm2.add(temp);
		}

		for (String s : p) {

			if (!hm1.contains(s) && !hm2.contains(s))
				return new StringBuilder();

			if (hm1.contains(s)) {
				ans.append("P");
				hm1.remove(s);
			}

			else {
				ans.append("S");
				hm2.remove(s);
			}
		}

		return ans;
	}

	// _________________________TEMPLATE_____________________________________________________________

	// private static int gcd(int a, int b) {
	// if(a== 0)
	// return b;
	//
	// return gcd(b%a,a);
	// }

	// static class comp implements Comparator<pair> {
	//
	// @Override
	// public int compare(pair o1, pair o2) {
	//
	// return (int) (o1.y - o1.y);
	// }
	//
	// }

	static class pair implements Comparable<pair> {
		long x;
		long y;
		long max;

		pair(long a, long s) {
			x = a;
			y = s;
			max = Math.max(a, s);
		}

		@Override
		public int compareTo(pair o) {
			return (int) (this.max - o.max);
		}
	}

	public static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[100000 + 1]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}

		public int[][] nextInt2DArray(int m, int n) throws IOException {
			int[][] arr = new int[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++)
					arr[i][j] = nextInt();
			}
			return arr;
		}

	}

}
