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.
"""
this is a standard python template for codeforces task, repo: github.com/solbiatialessandro/pyComPro/codeforces
"""
stdin = lambda type_ = "int", sep = " ": list(map(eval(type_), raw_input().split(sep)))
joint = lambda sep = " ", *args: sep.join(str(i) if type(i) != list else sep.join(map(str, i)) for i in args)
def solve(subs):
    #print subs
    #import pdb;pdb.set_trace()
    subs.sort(key = lambda x: len(x[0]))
    string1 = subs[-1][0] + subs[-2][0][-1]
    string2 = subs[-2][0] + subs[-1][0][-1]
    is1 = False
    if subs[-2][0] == string1[1:]: is1 = True
    string = string1 if is1 else string2
    #print string
    classes = [-1 for _ in subs]
    l = 1
    wrong = False
    for i in xrange(0, len(subs), 2):
        evaluate = subs[i][0]
        class_0 = evaluate == string[:l] #prefix
        if class_0:
            classes[i] = 0
            classes[i + 1] = 1
        elif evaluate != string[-l:]:
            #wront string
            wrong = True
            break
        else:
            classes[i] = 1
            classes[i + 1] = 0
        l += 1

    if wrong:
        is1 = not is1
        string = string1 if is1 else string2
        #print string
        classes = [-1 for _ in subs]
        l = 1
        wrong = False
        for i in xrange(0, len(subs), 2):
            evaluate = subs[i][0]
            class_0 = evaluate == string[:l] #prefix
            if class_0:
                classes[i] = 0
                classes[i + 1] = 1
            elif evaluate != string[-l:]:
                exit('no strings!')
            else:
                classes[i] = 1
                classes[i + 1] = 0
            l += 1

    res = ['' for _ in subs]
    for i, dd in enumerate(subs):
        index = dd[1]
        res[index] = 'S' if classes[i] else 'P'
    return joint('', res)


if __name__ == "__main__":
    """the solve(*args) structure is needed for testing purporses"""
    t = int(raw_input())
    subs = []
    for i in xrange(2*t - 2):
        s = raw_input()
        subs.append([s, i])
    print solve(subs)