s=gets i=s.index 'OOO' j=s.index 'XXX' puts i ? (j ? (i < j ? :East : :West) : :East) : (j ? :West : :NA)