import sys for a in sys.argv[1:]:print(([c for c in'XO'if c*3in(a[::4],a[1::4],a[2::4],a[:3],a[4:7],a[8:],a[::5],a[2::3])]+['-'])[0])