d={"p":["r", "r"], "s":["k", "s"], "k":["k", "p"], "r":["p", "s"]} input() m=[int(s) for s in input().split(" ")] poleb={"p"} for v in m: if v==-1: poleb={d[s][0] for s in poleb}.union({d[s][1] for s in poleb}) else: poleb={d[s][v] for s in poleb} print(poleb)