print$'-<>=~/(.) (.)/|$1eq$2?$1x~-$'.$2:-1