Under construction

Still being built. Things may change

Innohorse

Interview

Time limit1sMemory limit512 MB

Summary
Given the start and end cells of a knight-like jump on an 8x8 board, recover the ordered pair (x, y) with x <= y that describes the move.
Level

Easy3 of 10

Topics
Implementation, Math, Brute force, Geometry
Solved
No attempts yet

Problem

In Innokingdom there are special horses for chess knights, innohorses. Each innohorse is represented by a pair of integers (x,y)(x, y), 0≤x≤y0 \le x \le y. An innohorse moves in the following way: first it moves xx cells in one of the four general directions, then turns 90 degrees to the left or to the right, then finally moves yy more cells. For instance, an ordinary chess knight is an innohorse of type (1,2)(1, 2).

Alex and Jane have just seen one innohorse, it jumped from cell A to cell B. They wonder what the type of this innohorse is. Help them answer this question.

Input

The chessboard consists of 8 rows and 8 columns. Rows are assigned integers from 1 to 8, and columns are assigned letters from 'a' to 'h'. So every cell is represented by a pair of a letter and a digit.

Two lines consist of descriptions of cells A and B respectively.

Output

Print two integers xx and yy (0≤x≤y0 \le x \le y), representing the type of innohorse.

Examples2

  1. Example 1

    Input
    a1
    b3
    
    Expected output
    1 2
    
  2. Example 2

    Input
    g5
    d3
    
    Expected output
    2 3