import java.io.*;
import java.awt.*;
public class Template
{

    public static void main (String[] args) throws IOException
    {
	BufferedReader in = new BufferedReader (new FileReader ("DATA3.txt"));
	PrintWriter out = new PrintWriter (new FileWriter ("OUT3.txt"));
	String temp = new String ();
	for (int f = 0 ; f < 5 ; f++)
	{
	    temp = in.readLine ();
	    temp = Integer.toBinaryString (Integer.parseInt (temp));
	    temp = "0" + temp;
	    System.out.println (temp);
	    char[] ch = temp.toCharArray ();
	    for (int i = ch.length-2 ; i >=0 ; i--)
	    {
		if (ch [i] == '1')
		{
		    if (ch [i - 1] == '0')
		    {
			ch [i] = '0';
			ch [i - 1] = '1';
			temp = new String (ch);
			break;
		    }
		}

	    }
	    out.println (Integer.parseInt (temp, 2));
	}
	out.close ();

    }
}

