while 1:print((input()*2).rfind("LOS")+1or"PHONY")