process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// function printShortestPath(n, i_start, j_start, i_end, j_end) { // Print the distance along with the sequence of moves. var current = [j_start, i_start]; var goal = [j_end, i_end]; var moves = 0; while (isAbove(current, goal) && current[1]-goal[1]>1) { // is the goal above the knight if (isAbove(current, goal)) { current[1] = current[1] - 2; // is the goal to the left if (isLeft(current, goal)) { current[0] = current[0] - 1; moves++; } // the goal is to the right else if (isRight(current, goal)) { current[0] = current[0] + 1; moves++; } } } /* while (isRight(current, goal) && goal[0]-current[0]>1) { // is the goal directly right of the knight if (isRight(current, goal)) { current[0] = current[0] + 2; moves++; } } while (isBelow(current, goal) && goal[1]-current[1]>1) { // is the goal below the knight if (isBelow(current, goal)) { current[1] = current[1] + 2; // is the goal to the right if (isRight(current, goal)) { current[0] = current[0] + 1; moves++; } // the goal is to the left else if (isLeft(current, goal)) { current[0] = current[0] - 1; moves++; } } } while (isLeft(current, goal) && current[0]-goal[0]>1) { // is the goal directly left of the knight if (isLeft(current, goal)) { current[0] = current[0] - 2; moves++; } } */ // has goal been reached if (current[0] == goal[0] && current[1] == goal[1]) { console.log(moves); } else { console.log("Impossible"); //console.log(current); } } function isLeft (current, goal) { if(current[0]goal[0]) { return true; } } function isAbove (current, goal) { if(current[1]>goal[1]) { return true; } } function isBelow (current, goal) { if(current[1]