Under construction

Still being built. Things may change

Game

Interview

Time limit1sMemory limit1024 MB

Summary
Given four boxes holding some of the numbers 1 to 4, output the numbers that must fill the empty boxes, or the first two box contents when none are empty.
Level

Easy3 of 10

Topics
Array, Implementation, Simulation, Math
Solved
No attempts yet

Problem

Gabi and Bobi often play games during some of their more boring classes at school. Their favorite game is four boxes. In it, four empty boxes are given, and the numbers from 1 to 4 must be placed in them without repetition. The players take turns. After Bobi and Gabi had each made at least one move, they realized that a program could be written to make the remaining moves (if any).

You can help them by writing a program game that plays the next moves.

Input

The first line of the standard input contains four integers separated by a single space. Each number in turn shows the contents of each box (the boxes are numbered consecutively from 1 to 4). If a number is 0, that box is still empty. At least two of the boxes are not empty.

Output

On the first line of the standard output, the program must print two numbers separated by exactly one space.

If only one box is empty, the first number must show the number of that box, and the second number must show what its contents must be.

If two boxes are empty, the two numbers must show what the contents of the two empty boxes must be, ordered from the smaller to the larger number.

If no boxes are empty, the two numbers must be the contents of the first two boxes.

Examples3

  1. Example 1

    Input
    2 0 4 1
    
    Expected output
    2 3
    
  2. Example 2

    Input
    4 0 2 0
    
    Expected output
    1 3
    
  3. Example 3

    Input
    4 1 2 3
    
    Expected output
    4 1