import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.ArrayDeque;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Liavontsi Brechka
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CIgraNaTablice solver = new CIgraNaTablice();
        solver.solve(1, in, out);
        out.close();
    }

    static class CIgraNaTablice {
        String s;
        int[][] dp;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            s = in.next();
            dp = new int[s.length()][1 << 17];

            ArrayDeque<CIgraNaTablice.Pos> stack = new ArrayDeque<>();
            check(0, 0, stack);

            StringBuilder res = new StringBuilder();
            while (!stack.isEmpty()) {
                CIgraNaTablice.Pos last = stack.pollLast();
                res.append(last.i + 1).append(' ').append(last.j + 1).append('\n');
            }

            out.print(res);
        }

        private boolean check(int index, int bitmask, ArrayDeque<CIgraNaTablice.Pos> stack) {
            if (index >= s.length()) {
                return true;
            }
            if (dp[index][bitmask] != 0) return dp[index][bitmask] == 1;

            for (int i = 0; i < 4; i++) {
                boolean isOk = true;
                for (int j = 0; j < 4 && isOk; j++) {
                    if (((1 << (i * 4 + j)) & bitmask) == 0) isOk = false;
                }
                if (isOk) {
                    for (int j = 0; j < 4; j++) {
                        bitmask ^= (1 << (i * 4 + j));
                    }
                }
            }

            for (int i = 0; i < 4; i++) {
                boolean isOk = true;
                for (int j = 0; j < 4 && isOk; j++) {
                    if (((1 << (j * 4 + i)) & bitmask) == 0) isOk = false;
                }
                if (isOk) {
                    for (int j = 0; j < 4; j++) {
                        bitmask ^= (1 << (j * 4 + i));
                    }
                }
            }

            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    char next = s.charAt(index);

                    if (next == '0') {
                        if (i * 4 + j + 4 < 16 &&
                                ((1 << (i * 4 + j)) & bitmask) == 0 &&
                                ((1 << (i * 4 + j + 4)) & bitmask) == 0) {
                            int prev = bitmask;
                            bitmask |= (1 << (i * 4 + j));
                            bitmask |= (1 << (i * 4 + j + 4));
                            stack.push(new CIgraNaTablice.Pos(i, j));

                            dp[index][bitmask] = check(index + 1, bitmask, stack) ? 1 : -1;
                            if (dp[index][bitmask] == 1) return true;

                            stack.poll();
                            bitmask = prev;
                        }
                    } else {
                        if (j < 3 &&
                                ((1 << (i * 4 + j)) & bitmask) == 0 &&
                                ((1 << (i * 4 + j + 1)) & bitmask) == 0) {
                            int prev = bitmask;
                            bitmask |= (1 << (i * 4 + j));
                            bitmask |= (1 << (i * 4 + j + 1));
                            stack.push(new CIgraNaTablice.Pos(i, j));

                            dp[index][bitmask] = check(index + 1, bitmask, stack) ? 1 : -1;
                            if (dp[index][bitmask] == 1) return true;

                            stack.poll();
                            bitmask = prev;
                        }
                    }
                }
            }

            return false;
        }

        static class Pos {
            int i;
            int j;

            public Pos(int i, int j) {
                this.i = i;
                this.j = j;
            }

        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Liavontsi Brechka
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CIgraNaTablice solver = new CIgraNaTablice();
        solver.solve(1, in, out);
        out.close();
    }

    static class CIgraNaTablice {
        String s;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            s = in.next();
            int n = s.length();

            StringBuilder res = new StringBuilder();
            boolean[][] grid = new boolean[4][4];
            ArrayList<CIgraNaTablice.Pos> toRemove;
            out:
            for (int i = 0; i < n; i++) {

                toRemove = new ArrayList<>();
                for (int j = 0; j < 4; j++) {
                    boolean isOk = true;
                    for (int k = 0; k < 4; k++) {
                        if (!grid[j][k]) isOk = false;
                    }
                    if (isOk) {
                        for (int k = 0; k < 4; k++) {
                            toRemove.add(new CIgraNaTablice.Pos(j, k));
                        }
                    }
                }

                for (int j = 0; j < 4; j++) {
                    boolean isOk = true;
                    for (int k = 0; k < 4; k++) {
                        if (!grid[k][j]) isOk = false;
                    }
                    if (isOk) {
                        for (int k = 0; k < 4; k++) {
                            toRemove.add(new CIgraNaTablice.Pos(k, j));
                        }
                    }
                }

                for (CIgraNaTablice.Pos pos : toRemove) grid[pos.i][pos.j] = false;

                if (s.charAt(i) == '0') {
                    for (int j = 0; j < 4; j++) {
                        for (int k = 0; k < 4; k++) {
                            if (j < 3 && !grid[j][k] && !grid[j + 1][k]) {
                                grid[j][k] = grid[j + 1][k] = true;
                                res.append(j + 1).append(' ').append(k + 1).append('\n');
                                continue out;
                            }
                        }
                    }
                } else {
                    for (int j = 3; j >= 0; j--) {
                        for (int k = 3; k >= 0; k--) {
                            if (j < 3 && !grid[j][k] && !grid[j + 1][k]) {
                                grid[j][k] = grid[j + 1][k] = true;
                                res.append(j + 1).append(' ').append(k + 1).append('\n');
                                continue out;
                            }
                        }
                    }
                }

                throw new RuntimeException(s + " " + i + "");
            }

            out.print(res);
        }

        static class Pos {
            int i;
            int j;

            public Pos(int i, int j) {
                this.i = i;
                this.j = j;
            }

        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Liavontsi Brechka
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CIgraNaTablice solver = new CIgraNaTablice();
        solver.solve(1, in, out);
        out.close();
    }

    static class CIgraNaTablice {
        String s;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            s = in.next();
            int n = s.length();

            StringBuilder res = new StringBuilder();
            boolean[][] grid = new boolean[4][4];
            ArrayList<CIgraNaTablice.Pos> toRemove;
            out:
            for (int i = 0; i < n; i++) {

                toRemove = new ArrayList<>();
                for (int j = 0; j < 4; j++) {
                    boolean isOk = true;
                    for (int k = 0; k < 4; k++) {
                        if (!grid[j][k]) isOk = false;
                    }
                    if (isOk) {
                        for (int k = 0; k < 4; k++) {
                            toRemove.add(new CIgraNaTablice.Pos(j, k));
                        }
                    }
                }

                for (int j = 0; j < 4; j++) {
                    boolean isOk = true;
                    for (int k = 0; k < 4; k++) {
                        if (!grid[k][j]) isOk = false;
                    }
                    if (isOk) {
                        for (int k = 0; k < 4; k++) {
                            toRemove.add(new CIgraNaTablice.Pos(k, j));
                        }
                    }
                }

                for (CIgraNaTablice.Pos pos : toRemove) grid[pos.i][pos.j] = false;

                if (s.charAt(i) == '0') {
                    for (int j = 0; j < 4; j++) {
                        for (int k = 0; k < 4; k++) {
                            if (j < 3 && !grid[j][k] && !grid[j + 1][k]) {
                                grid[j][k] = grid[j + 1][k] = true;
                                res.append(j + 1).append(' ').append(k + 1).append('\n');
                                continue out;
                            }
                        }
                    }
                } else {
                    for (int j = 3; j >= 0; j--) {
                        for (int k = 3; k >= 0; k--) {
                            if (k < 3 && !grid[j][k] && !grid[j][k + 1]) {
                                grid[j][k] = grid[j][k + 1] = true;
                                res.append(j + 1).append(' ').append(k + 1).append('\n');
                                continue out;
                            }
                        }
                    }
                }

                throw new RuntimeException(s + " " + i + "");
            }

            out.print(res);
        }

        static class Pos {
            int i;
            int j;

            public Pos(int i, int j) {
                this.i = i;
                this.j = j;
            }

        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Liavontsi Brechka
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CIgraNaTablice solver = new CIgraNaTablice();
        solver.solve(1, in, out);
        out.close();
    }

    static class CIgraNaTablice {
        String s;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            s = in.next();
            int n = s.length();

            StringBuilder res = new StringBuilder();
            boolean[][] grid = new boolean[4][4];
            ArrayList<CIgraNaTablice.Pos> toRemove;
            out:
            for (int i = 0; i < n; i++) {

                toRemove = new ArrayList<>();
                for (int j = 0; j < 4; j++) {
                    boolean isOk = true;
                    for (int k = 0; k < 4; k++) {
                        if (!grid[j][k]) isOk = false;
                    }
                    if (isOk) {
                        for (int k = 0; k < 4; k++) {
                            toRemove.add(new CIgraNaTablice.Pos(j, k));
                        }
                    }
                }

                for (int j = 0; j < 4; j++) {
                    boolean isOk = true;
                    for (int k = 0; k < 4; k++) {
                        if (!grid[k][j]) isOk = false;
                    }
                    if (isOk) {
                        for (int k = 0; k < 4; k++) {
                            toRemove.add(new CIgraNaTablice.Pos(k, j));
                        }
                    }
                }

                for (CIgraNaTablice.Pos pos : toRemove) grid[pos.i][pos.j] = false;

                for (int j = 0; j < 4; j++) {
                    for (int k = 0; k < 4; k++) {
                        if (s.charAt(i) == '0') {
                            if (j < 3 && !grid[j][k] && !grid[j + 1][k]) {
                                grid[j][k] = grid[j + 1][k] = true;
                                res.append(j + 1).append(' ').append(k + 1).append('\n');
                                continue out;
                            }
                        } else {
                            if (k < 3 && !grid[j][k] && !grid[j][k + 1]) {
                                grid[j][k] = grid[j][k + 1] = true;
                                res.append(j + 1).append(' ').append(k + 1).append('\n');
                                continue out;
                            }
                        }
                    }
                }

                throw new RuntimeException(s + " " + i + "");
            }

            out.print(res);
        }

        static class Pos {
            int i;
            int j;

            public Pos(int i, int j) {
                this.i = i;
                this.j = j;
            }

        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Liavontsi Brechka
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CIgraNaTablice solver = new CIgraNaTablice();
        solver.solve(1, in, out);
        out.close();
    }

    static class CIgraNaTablice {
        String s;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            s = in.next();
            int n = s.length();

            StringBuilder res = new StringBuilder();
            boolean[][] grid = new boolean[4][4];
            out:
            for (int i = 0; i < n; i++) {

                for (int j = 0; j < 4; j++) {
                    boolean isOk = true;
                    for (int k = 0; k < 4; k++) {
                        if (!grid[j][k]) isOk = false;
                    }
                    if (isOk) {
                        for (int k = 0; k < 4; k++) {
                            grid[j][k] = false;
                        }
                    }
                }

                for (int j = 0; j < 4; j++) {
                    boolean isOk = true;
                    for (int k = 0; k < 4; k++) {
                        if (!grid[k][j]) isOk = false;
                    }
                    if (isOk) {
                        for (int k = 0; k < 4; k++) {
                            grid[k][j] = false;
                        }
                    }
                }

                for (int j = 0; j < 4; j++) {
                    for (int k = 0; k < 4; k++) {
                        if (s.charAt(i) == '0') {
                            if (j < 3 && !grid[j][k] && !grid[j + 1][k]) {
                                grid[j][k] = grid[j + 1][k] = true;
                                res.append(j + 1).append(' ').append(k + 1).append('\n');
                                continue out;
                            }
                        } else {
                            if (k < 3 && !grid[j][k] && !grid[j][k + 1]) {
                                grid[j][k] = grid[j][k + 1] = true;
                                res.append(j + 1).append(' ').append(k + 1).append('\n');
                                continue out;
                            }
                        }
                    }
                }
            }

            out.print(res);
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}


import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class C {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        char[] s = in.next().toCharArray();
        int a[][] = new int[5][5];
        for(char ch: s) {
            place(a, ch);
            clear(a);
            if(r == -1 || c == -1) throw new RuntimeException();
            pw.println(r+ " "+c);
        }
        pw.close();
    }

    static int r, c;
    static void place(int a[][], char type) {
        r = -1; c = -1;
        if(type == '0') {
            for(int i = 1; i <= 4; i++) {
                for(int j = 1; j <= 4; j++) {
                    if(i+1 <= 4 && a[i][j] == 0  && a[i+1][j] == 0) {
                        a[i][j] = a[i+1][j] = 1;
                        r = i; c = j;
                        return;
                    }
                }
            }
        } else {
            for(int i = 1; i <= 4; i++) {
                for(int j = 1; j <= 4; j++) {
                    if(j+1 <= 4 && a[i][j] == 0  && a[i][j+1] == 0) {
                        a[i][j] = a[i][j+1] = 1;
                        r = i; c = j;
                        return;
                    }
                }
            }
        }
    }

    static void clear(int a[][]) {
        for (int i = 1; i <= 4; i++) {
            boolean ok = true;
            for(int j = 1; j <= 4; j++) {
                ok &= (a[i][j] != 0);
            }
            if(!ok) continue;
            for(int j = 1; j <= 4; j++) {
                a[i][j] = 2;
            }
        }

        for(int j = 1; j <= 4; j++) {
            boolean ok = true;
            for(int i = 1; i <= 4; i++) {
                ok &= (a[i][j] != 0);
            }
            if(!ok) continue;
            for(int i = 1; i <= 4; i++) {
                a[i][j] = 2;
            }
        }

        for (int i = 1; i <= 4; i++) {
            for(int j = 1; j <= 4; j++) {
                if(a[i][j] == 2) a[i][j] = 0;
            }
        }
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}


import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class C_2 {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        char[] s = in.next().toCharArray();
        boolean horizontal = false, vertical = false;
        for (char c : s) {
            boolean isHorizontal = (c == '1');
            if (isHorizontal && !horizontal) {
                pw.println("1 1");
                horizontal = true;
            } else if (isHorizontal && horizontal) {
                pw.println("1 3");
                horizontal = false;
            } else if (!vertical) {
                pw.println("3 4");
                vertical = true;
            } else {
                pw.println("1 4");
                vertical = false;
            }
        }

        pw.close();
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;

public class A {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String s = buf.readLine();

		int iniC = 1, iniR = 1;
		for(int i = 0; i < s.length(); i++) {
			int d = s.charAt(i) - '0';
			if(d ==0) {
				System.out.println(iniR + " " + 1);
				iniR = (iniR + 2) % 4;
			}else {
				if(iniC == 0)iniC = 4;
				System.out.println(iniC + " " + 2);
				iniC = (iniC + 1) % 4;
			}
		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {

	static boolean board[][];

	public static boolean colocation(int r , int c, int bit) {
		if(bit == 0) {
			return board[r][c] & board[r + 1][c];
		}else return board[r][c] & board[r][c + 1];
	}

	public static void clean() {
		for(int i = 1; i <= 4; i++) {
			if(!board[i][1] && !board[i][2] && !board[i][3] && !board[i][4]) {
				board[i][1] = board[i][2] = board[i][3] = board[i][4] = true;
			}
			if(!board[1][i] && !board[2][i] && !board[3][i] && !board[4][i]) {
				board[1][i] = board[2][i] = board[3][i] = board[4][i] = true;
			}
		}
	}

	public static void findposition(int n) {
		lab:
		for(int i = 1; i <= 4; i++) {
			for(int j = 1; j <= 4; j++) {
				if(colocation(i, j, n)) {
                    if(n == 0) {
                    	board[i][j] = board[i + 1][j] = false;
                    }else {
                    	board[i][j] = board[i][j + 1] = false;
                    }
                    clean();
                    System.out.println(i + " " + j);
                    break lab;
				}
			}
		}

	}

	public static void doit(String s) {
		board = new boolean[6][6];
		for(int i = 0; i < 6; i++)
			for(int j = 0; j < 6; j++) {
				board[i][j] = true;
			}
		for(int i = 0; i < 6; i++) {
			board[0][i] = board[i][0] = false;
			board[5][i] = board[i][5] = false;
		}
		for(int i = 0; i  < s.length() ; i++) {
            findposition(s.charAt(i)-'0');
		}
	}

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

        doit(buf.readLine());

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;

public class A {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String s = buf.readLine();

		int iniC = 1, iniR = 1;
		for(int i = 0; i < s.length(); i++) {
			int d = s.charAt(i) - '0';
			if(d ==0) {
				System.out.println(iniR + " " + 1);
				iniR = (iniR + 2) % 4;
			}else {
				System.out.println(iniC + " " + 2);
				iniC = (iniC + 1) % 4;
				if(iniR == 0)iniC = 4;
			}
		}

	}

}


// package CF1104;

import java.io.*;
import java.util.*;

public class CF1104C {
    static FastReader s;
    static PrintWriter out;
    static String INPUT = "010\n";

    public static void main(String[] args) {
        long time = System.currentTimeMillis();
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        out = new PrintWriter(System.out);
        s = new FastReader(oj);

//        int n = s.nextInt();
//        int[] arr = s.nextIntArray(n);
        String str = s.next();
        boolean[][] grid = new boolean[4][4];
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '0') {
                if(!grid[0][0]) {
                    ans.append("1 1\n");
                    grid[0][0] = true;
                } else if(!grid[0][1]) {
                    ans.append("1 2\n");
                    grid[0][1] = true;
                } else if(!grid[0][2]) {
                    ans.append("1 3\n");
                    grid[0][2] = true;
                } else {
                    ans.append("1 4\n");
                    grid[0][0] = false;
                    grid[0][1] = false;
                    grid[0][2] = false;
                }
            } else {
                if(!grid[2][0]) {
                    ans.append("3 1\n");
                    grid[2][0] = true;
                } else if(!grid[2][2]) {
                    ans.append("3 3\n");
                    grid[2][2] = true;
                } else if(!grid[3][0]) {
                    ans.append("4 1\n");
                    grid[3][0] = true;
                } else {
                    ans.append("4 3\n");
                    grid[2][0] = false;
                    grid[3][0] = false;
                    grid[2][2] = false;
                }
            }
        }
        out.println(ans);

        if (!oj) {
            System.out.println(Arrays.deepToString(new Object[]{System.currentTimeMillis() - time + " ms"}));
        }
        out.flush();
    }

    private static class Maths {
        static ArrayList<Long> printDivisors(long n) {
            // Note that this loop runs till square root
            ArrayList<Long> list = new ArrayList<>();
            for (long i = 1; i <= Math.sqrt(n); i++) {
                if (n % i == 0) {
                    if (n / i == i) {
                        list.add(i);
                    } else {
                        list.add(i);
                        list.add(n / i);
                    }
                }
            }
            return list;
        }

        //    GCD - Using Euclid theorem.
        private static long gcd(long a, long b) {
            if (b == 0) {
                return a;
            }

            return gcd(b, a % b);
        }

        //    Extended euclidean algorithm
//    Used to solve equations of the form ax + by = gcd(a,b)
//    return array [d, a, b] such that d = gcd(p, q), ap + bq = d
        static long[] extendedEuclidean(long p, long q) {
            if (q == 0)
                return new long[]{p, 1, 0};

            long[] vals = extendedEuclidean(q, p % q);
            long d = vals[0];
            long a = vals[2];
            long b = vals[1] - (p / q) * vals[2];
            return new long[]{d, a, b};
        }

        // X ^ y mod p
        static long power(long x, long y, long p) {
            long res = 1;
            x = x % p;

            while (y > 0) {
                if ((y & 1) == 1)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

        // Returns modulo inverse of a
        // with respect to m using extended
        // Euclid Algorithm. Refer below post for details:
        // https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/
        static long inv(long a, long m) {
            long m0 = m, t, q;
            long x0 = 0, x1 = 1;

            if (m == 1)
                return 0;

            // Apply extended Euclid Algorithm
            while (a > 1) {
                q = a / m;
                t = m;
                m = a % m;
                a = t;
                t = x0;
                x0 = x1 - q * x0;
                x1 = t;
            }

            // Make x1 positive
            if (x1 < 0)
                x1 += m0;

            return x1;
        }

        // k is size of num[] and rem[].
        // Returns the smallest number
        // x such that:
        // x % num[0] = rem[0],
        // x % num[1] = rem[1],
        // ..................
        // x % num[k-2] = rem[k-1]
        // Assumption: Numbers in num[] are pairwise
        // coprime (gcd for every pair is 1)
        static long findMinX(long num[], long rem[], long k) {
            int prod = 1;
            for (int i = 0; i < k; i++)
                prod *= num[i];

            int result = 0;
            for (int i = 0; i < k; i++) {
                long pp = prod / num[i];
                result += rem[i] * inv(pp, num[i]) * pp;
            }

            return result % prod;
        }
    }

    private static class BS {
        //  Binary search
        private static int binarySearch(int[] arr, int ele) {
            int low = 0;
            int high = arr.length - 1;
            while (low <= high) {
                int mid = (low + high) / 2;
                if (arr[mid] == ele) {
                    return mid;
                } else if (ele < arr[mid]) {
                    high = mid - 1;
                } else {
                    low = mid + 1;
                }
            }
            return -1;
        }

        //    First occurence using binary search
        private static int binarySearchFirstOccurence(int[] arr, int ele) {
            int low = 0;
            int high = arr.length - 1;
            int ans = -1;
            while (low <= high) {
                int mid = (low + high) / 2;
                if (arr[mid] == ele) {
                    ans = mid;
                    high = mid - 1;
                } else if (ele < arr[mid]) {
                    high = mid - 1;
                } else {
                    low = mid + 1;
                }
            }
            return ans;
        }

        //    Last occurenece using binary search
        private static int binarySearchLastOccurence(int[] arr, int ele) {
            int low = 0;
            int high = arr.length - 1;
            int ans = -1;
            while (low <= high) {
                int mid = (low + high) / 2;
                if (arr[mid] == ele) {
                    ans = mid;
                    low = mid + 1;
                } else if (ele < arr[mid]) {
                    high = mid - 1;
                } else {
                    low = mid + 1;
                }
            }
            return ans;
        }
    }

    private static class arrays {
        // Merge sort
        static void merge(int arr[], int l, int m, int r) {
            int n1 = m - l + 1;
            int n2 = r - m;
            int L[] = new int[n1];
            int R[] = new int[n2];
            for (int i = 0; i < n1; ++i)
                L[i] = arr[l + i];
            for (int j = 0; j < n2; ++j)
                R[j] = arr[m + 1 + j];
            int i = 0, j = 0;
            int k = l;
            while (i < n1 && j < n2) {
                if (L[i] <= R[j]) {
                    arr[k] = L[i];
                    i++;
                } else {
                    arr[k] = R[j];
                    j++;
                }
                k++;
            }

            while (i < n1) {
                arr[k] = L[i];
                i++;
                k++;
            }

            while (j < n2) {
                arr[k] = R[j];
                j++;
                k++;
            }
        }

        static void sort(int arr[], int l, int r) {
            if (l < r) {
                int m = (l + r) / 2;
                sort(arr, l, m);
                sort(arr, m + 1, r);
                merge(arr, l, m, r);
            }
        }

        static void sort(int[] arr) {
            sort(arr, 0, arr.length - 1);
        }
    }

    private static class UnionFindDisjointSet {
        int[] parent;
        int[] size;
        int n;
        int size1;

        public UnionFindDisjointSet(int n) {
            this.n = n;
            this.parent = new int[n];
            this.size = new int[n];
            for (int i = 0; i < n; i++) {
                parent[i] = i;
            }

            for (int i = 0; i < n; i++) {
                size[i] = 1;
            }

            this.size1 = n;
        }

        private int numDisjointSets() {
            System.out.println(size1);
            return size1;
        }

        private boolean find(int a, int b) {
            int rootA = root(a);
            int rootB = root(b);
            if (rootA == rootB) {
                return true;
            }
            return false;
        }

        private int root(int b) {
            while (parent[b] != b) {
                parent[b] = parent[parent[b]];
                b = parent[b];
            }
            return b;
        }

        private void union(int a, int b) {
            int rootA = root(a);
            int rootB = root(b);
            if (rootA == rootB) {
                return;
            }

            if (size[rootA] < size[rootB]) {
                parent[rootA] = parent[rootB];
                size[rootB] += size[rootA];
            } else {
                parent[rootB] = parent[rootA];
                size[rootA] += size[rootB];
            }
            size1--;
            System.out.println(Arrays.toString(parent));
        }
    }

    private static class SegTree {
        int[] st;
        int[] arr;

        public SegTree(int[] arr) {
            this.arr = arr;
            int size = (int) Math.ceil(Math.log(arr.length) / Math.log(2));
            st = new int[(int) ((2 * Math.pow(2, size)) - 1)];
            buildSegmentTree(1, 0, arr.length - 1);
        }

        //**********JUST CALL THE CONSTRUCTOR, THIS FUNCTION WILL BE CALLED AUTOMATICALLY******
        private void buildSegmentTree(int index, int L, int R) {
            if (L == R) {
                st[index] = arr[L];
                return;
            }

            buildSegmentTree(index * 2, L, (L + R) / 2);
            buildSegmentTree(index * 2 + 1, (L + R) / 2 + 1, R);
//          Replace this line if you want to change the function of the Segment tree.
            st[index] = Math.min(st[index * 2], st[index * 2 + 1]);
        }

        //***********We have to use this function **************
        private int Query(int queL, int queR) {
            return Query1(1, 0, arr.length - 1, queL, queR);
        }

        //This is a helper function.
        //************* DO NOT USE THIS ****************
        private int Query1(int index, int segL, int segR, int queL, int queR) {
            if (queL > segR || queR < segL) {
                return -1;
            }

            if (queL <= segL && queR >= segR) {
                return st[index];
            }

            int ans1 = Query1(index * 2, segL, (segL + segR) / 2, queL, queR);
            int ans2 = Query1(index * 2 + 1, (segL + segR) / 2 + 1, segR, queL, queR);
            if (ans1 == -1) {
                return ans2;
            }

            if (ans2 == -1) {
                return ans1;
            }
//             Segment tree implemented for range minimum query. Change the below line to change the function.
            return Math.min(ans1, ans2);
        }

        private void update(int idx, int val) {
            update1(1, 0, arr.length - 1, idx, val);
        }

        private void update1(int node, int queL, int queR, int idx, int val) {
            // idx - index to be updated in the array
            // node - index to be updated in the seg tree
            if (queL == queR) {
                // Leaf node
                arr[idx] += val;
                st[node] += val;
            } else {
                int mid = (queL + queR) / 2;
                if (queL <= idx && idx <= mid) {
                    // If idx is in the left child, recurse on the left child
                    update1(2 * node, queL, mid, idx, val);
                } else {
                    // if idx is in the right child, recurse on the right child
                    update1(2 * node + 1, mid + 1, queR, idx, val);
                }
                // Internal node will have the min of both of its children
                st[node] = Math.min(st[2 * node], st[2 * node + 1]);
            }
        }

    }

    private static class FastReader {
        InputStream is;

        public FastReader(boolean onlineJudge) {
            is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        }

        byte[] inbuf = new byte[1024];
        public int lenbuf = 0, ptrbuf = 0;

        int readByte() {
            if (lenbuf == -1)
                throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = is.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0)
                    return -1;
            }
            return inbuf[ptrbuf++];
        }

        boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }

        int skip() {
            int b;
            while ((b = readByte()) != -1 && isSpaceChar(b))
                ;
            return b;
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char) skip();
        }

        String next() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        String nextLine() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        char[] next(int n) {
            char[] buf = new char[n];
            int b = skip(), p = 0;
            while (p < n && !(isSpaceChar(b))) {
                buf[p++] = (char) b;
                b = readByte();
            }
            return n == p ? buf : Arrays.copyOf(buf, p);
        }

        int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
                ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        long nextLong() {
            long num = 0;
            int b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
                ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        char[][] nextMatrix(int n, int m) {
            char[][] map = new char[n][];
            for (int i = 0; i < n; i++)
                map[i] = next(m);
            return map;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        int[][] next2DInt(int n, int m) {
            int[][] arr = new int[n][];
            for (int i = 0; i < n; i++) {
                arr[i] = nextIntArray(m);
            }
            return arr;
        }

        long[][] next2DLong(int n, int m) {
            long[][] arr = new long[n][];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLongArray(m);
            }
            return arr;
        }

        int[] shuffle(int[] arr) {
            Random r = new Random();
            for (int i = 1, j; i < arr.length; i++) {
                j = r.nextInt(i);
                arr[i] = arr[i] ^ arr[j];
                arr[j] = arr[i] ^ arr[j];
                arr[i] = arr[i] ^ arr[j];
            }
            return arr;
        }

        int[] uniq(int[] arr) {
            Arrays.sort(arr);
            int[] rv = new int[arr.length];
            int pos = 0;
            rv[pos++] = arr[0];
            for (int i = 1; i < arr.length; i++) {
                if (arr[i] != arr[i - 1]) {
                    rv[pos++] = arr[i];
                }
            }
            return Arrays.copyOf(rv, pos);
        }
    }
}


// package CF1104;

import java.io.*;
import java.util.*;

public class CF1104C {
    static FastReader s;
    static PrintWriter out;
    static String INPUT = "010\n";

    public static void main(String[] args) {
        long time = System.currentTimeMillis();
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        out = new PrintWriter(System.out);
        s = new FastReader(oj);

//        int n = s.nextInt();
//        int[] arr = s.nextIntArray(n);
        String str = s.next();
        boolean[][] grid = new boolean[4][4];
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '0') {
                if(!grid[0][0]) {
                    ans.append("1 1\n");
                    grid[0][0] = true;
                } else if(!grid[0][1]) {
                    ans.append("1 2\n");
                    grid[0][1] = true;
                } else if(!grid[0][2]) {
                    ans.append("1 3\n");
                    grid[0][2] = true;
                } else {
                    ans.append("1 4\n");
                    grid[0][0] = false;
                    grid[0][1] = false;
                    grid[0][2] = false;
                }
            } else {
                if(!grid[2][0]) {
                    ans.append("2 1\n");
                    grid[2][0] = true;
                } else if(!grid[2][2]) {
                    ans.append("2 3\n");
                    grid[2][2] = true;
                } else if(!grid[3][0]) {
                    ans.append("4 1\n");
                    grid[3][0] = true;
                } else {
                    ans.append("4 3\n");
                    grid[2][0] = false;
                    grid[3][0] = false;
                    grid[2][2] = false;
                }
            }
        }
        out.println(ans);

        if (!oj) {
            System.out.println(Arrays.deepToString(new Object[]{System.currentTimeMillis() - time + " ms"}));
        }
        out.flush();
    }

    private static class Maths {
        static ArrayList<Long> printDivisors(long n) {
            // Note that this loop runs till square root
            ArrayList<Long> list = new ArrayList<>();
            for (long i = 1; i <= Math.sqrt(n); i++) {
                if (n % i == 0) {
                    if (n / i == i) {
                        list.add(i);
                    } else {
                        list.add(i);
                        list.add(n / i);
                    }
                }
            }
            return list;
        }

        //    GCD - Using Euclid theorem.
        private static long gcd(long a, long b) {
            if (b == 0) {
                return a;
            }

            return gcd(b, a % b);
        }

        //    Extended euclidean algorithm
//    Used to solve equations of the form ax + by = gcd(a,b)
//    return array [d, a, b] such that d = gcd(p, q), ap + bq = d
        static long[] extendedEuclidean(long p, long q) {
            if (q == 0)
                return new long[]{p, 1, 0};

            long[] vals = extendedEuclidean(q, p % q);
            long d = vals[0];
            long a = vals[2];
            long b = vals[1] - (p / q) * vals[2];
            return new long[]{d, a, b};
        }

        // X ^ y mod p
        static long power(long x, long y, long p) {
            long res = 1;
            x = x % p;

            while (y > 0) {
                if ((y & 1) == 1)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

        // Returns modulo inverse of a
        // with respect to m using extended
        // Euclid Algorithm. Refer below post for details:
        // https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/
        static long inv(long a, long m) {
            long m0 = m, t, q;
            long x0 = 0, x1 = 1;

            if (m == 1)
                return 0;

            // Apply extended Euclid Algorithm
            while (a > 1) {
                q = a / m;
                t = m;
                m = a % m;
                a = t;
                t = x0;
                x0 = x1 - q * x0;
                x1 = t;
            }

            // Make x1 positive
            if (x1 < 0)
                x1 += m0;

            return x1;
        }

        // k is size of num[] and rem[].
        // Returns the smallest number
        // x such that:
        // x % num[0] = rem[0],
        // x % num[1] = rem[1],
        // ..................
        // x % num[k-2] = rem[k-1]
        // Assumption: Numbers in num[] are pairwise
        // coprime (gcd for every pair is 1)
        static long findMinX(long num[], long rem[], long k) {
            int prod = 1;
            for (int i = 0; i < k; i++)
                prod *= num[i];

            int result = 0;
            for (int i = 0; i < k; i++) {
                long pp = prod / num[i];
                result += rem[i] * inv(pp, num[i]) * pp;
            }

            return result % prod;
        }
    }

    private static class BS {
        //  Binary search
        private static int binarySearch(int[] arr, int ele) {
            int low = 0;
            int high = arr.length - 1;
            while (low <= high) {
                int mid = (low + high) / 2;
                if (arr[mid] == ele) {
                    return mid;
                } else if (ele < arr[mid]) {
                    high = mid - 1;
                } else {
                    low = mid + 1;
                }
            }
            return -1;
        }

        //    First occurence using binary search
        private static int binarySearchFirstOccurence(int[] arr, int ele) {
            int low = 0;
            int high = arr.length - 1;
            int ans = -1;
            while (low <= high) {
                int mid = (low + high) / 2;
                if (arr[mid] == ele) {
                    ans = mid;
                    high = mid - 1;
                } else if (ele < arr[mid]) {
                    high = mid - 1;
                } else {
                    low = mid + 1;
                }
            }
            return ans;
        }

        //    Last occurenece using binary search
        private static int binarySearchLastOccurence(int[] arr, int ele) {
            int low = 0;
            int high = arr.length - 1;
            int ans = -1;
            while (low <= high) {
                int mid = (low + high) / 2;
                if (arr[mid] == ele) {
                    ans = mid;
                    low = mid + 1;
                } else if (ele < arr[mid]) {
                    high = mid - 1;
                } else {
                    low = mid + 1;
                }
            }
            return ans;
        }
    }

    private static class arrays {
        // Merge sort
        static void merge(int arr[], int l, int m, int r) {
            int n1 = m - l + 1;
            int n2 = r - m;
            int L[] = new int[n1];
            int R[] = new int[n2];
            for (int i = 0; i < n1; ++i)
                L[i] = arr[l + i];
            for (int j = 0; j < n2; ++j)
                R[j] = arr[m + 1 + j];
            int i = 0, j = 0;
            int k = l;
            while (i < n1 && j < n2) {
                if (L[i] <= R[j]) {
                    arr[k] = L[i];
                    i++;
                } else {
                    arr[k] = R[j];
                    j++;
                }
                k++;
            }

            while (i < n1) {
                arr[k] = L[i];
                i++;
                k++;
            }

            while (j < n2) {
                arr[k] = R[j];
                j++;
                k++;
            }
        }

        static void sort(int arr[], int l, int r) {
            if (l < r) {
                int m = (l + r) / 2;
                sort(arr, l, m);
                sort(arr, m + 1, r);
                merge(arr, l, m, r);
            }
        }

        static void sort(int[] arr) {
            sort(arr, 0, arr.length - 1);
        }
    }

    private static class UnionFindDisjointSet {
        int[] parent;
        int[] size;
        int n;
        int size1;

        public UnionFindDisjointSet(int n) {
            this.n = n;
            this.parent = new int[n];
            this.size = new int[n];
            for (int i = 0; i < n; i++) {
                parent[i] = i;
            }

            for (int i = 0; i < n; i++) {
                size[i] = 1;
            }

            this.size1 = n;
        }

        private int numDisjointSets() {
            System.out.println(size1);
            return size1;
        }

        private boolean find(int a, int b) {
            int rootA = root(a);
            int rootB = root(b);
            if (rootA == rootB) {
                return true;
            }
            return false;
        }

        private int root(int b) {
            while (parent[b] != b) {
                parent[b] = parent[parent[b]];
                b = parent[b];
            }
            return b;
        }

        private void union(int a, int b) {
            int rootA = root(a);
            int rootB = root(b);
            if (rootA == rootB) {
                return;
            }

            if (size[rootA] < size[rootB]) {
                parent[rootA] = parent[rootB];
                size[rootB] += size[rootA];
            } else {
                parent[rootB] = parent[rootA];
                size[rootA] += size[rootB];
            }
            size1--;
            System.out.println(Arrays.toString(parent));
        }
    }

    private static class SegTree {
        int[] st;
        int[] arr;

        public SegTree(int[] arr) {
            this.arr = arr;
            int size = (int) Math.ceil(Math.log(arr.length) / Math.log(2));
            st = new int[(int) ((2 * Math.pow(2, size)) - 1)];
            buildSegmentTree(1, 0, arr.length - 1);
        }

        //**********JUST CALL THE CONSTRUCTOR, THIS FUNCTION WILL BE CALLED AUTOMATICALLY******
        private void buildSegmentTree(int index, int L, int R) {
            if (L == R) {
                st[index] = arr[L];
                return;
            }

            buildSegmentTree(index * 2, L, (L + R) / 2);
            buildSegmentTree(index * 2 + 1, (L + R) / 2 + 1, R);
//          Replace this line if you want to change the function of the Segment tree.
            st[index] = Math.min(st[index * 2], st[index * 2 + 1]);
        }

        //***********We have to use this function **************
        private int Query(int queL, int queR) {
            return Query1(1, 0, arr.length - 1, queL, queR);
        }

        //This is a helper function.
        //************* DO NOT USE THIS ****************
        private int Query1(int index, int segL, int segR, int queL, int queR) {
            if (queL > segR || queR < segL) {
                return -1;
            }

            if (queL <= segL && queR >= segR) {
                return st[index];
            }

            int ans1 = Query1(index * 2, segL, (segL + segR) / 2, queL, queR);
            int ans2 = Query1(index * 2 + 1, (segL + segR) / 2 + 1, segR, queL, queR);
            if (ans1 == -1) {
                return ans2;
            }

            if (ans2 == -1) {
                return ans1;
            }
//             Segment tree implemented for range minimum query. Change the below line to change the function.
            return Math.min(ans1, ans2);
        }

        private void update(int idx, int val) {
            update1(1, 0, arr.length - 1, idx, val);
        }

        private void update1(int node, int queL, int queR, int idx, int val) {
            // idx - index to be updated in the array
            // node - index to be updated in the seg tree
            if (queL == queR) {
                // Leaf node
                arr[idx] += val;
                st[node] += val;
            } else {
                int mid = (queL + queR) / 2;
                if (queL <= idx && idx <= mid) {
                    // If idx is in the left child, recurse on the left child
                    update1(2 * node, queL, mid, idx, val);
                } else {
                    // if idx is in the right child, recurse on the right child
                    update1(2 * node + 1, mid + 1, queR, idx, val);
                }
                // Internal node will have the min of both of its children
                st[node] = Math.min(st[2 * node], st[2 * node + 1]);
            }
        }

    }

    private static class FastReader {
        InputStream is;

        public FastReader(boolean onlineJudge) {
            is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        }

        byte[] inbuf = new byte[1024];
        public int lenbuf = 0, ptrbuf = 0;

        int readByte() {
            if (lenbuf == -1)
                throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = is.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0)
                    return -1;
            }
            return inbuf[ptrbuf++];
        }

        boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }

        int skip() {
            int b;
            while ((b = readByte()) != -1 && isSpaceChar(b))
                ;
            return b;
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char) skip();
        }

        String next() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        String nextLine() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        char[] next(int n) {
            char[] buf = new char[n];
            int b = skip(), p = 0;
            while (p < n && !(isSpaceChar(b))) {
                buf[p++] = (char) b;
                b = readByte();
            }
            return n == p ? buf : Arrays.copyOf(buf, p);
        }

        int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
                ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        long nextLong() {
            long num = 0;
            int b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
                ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        char[][] nextMatrix(int n, int m) {
            char[][] map = new char[n][];
            for (int i = 0; i < n; i++)
                map[i] = next(m);
            return map;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        int[][] next2DInt(int n, int m) {
            int[][] arr = new int[n][];
            for (int i = 0; i < n; i++) {
                arr[i] = nextIntArray(m);
            }
            return arr;
        }

        long[][] next2DLong(int n, int m) {
            long[][] arr = new long[n][];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLongArray(m);
            }
            return arr;
        }

        int[] shuffle(int[] arr) {
            Random r = new Random();
            for (int i = 1, j; i < arr.length; i++) {
                j = r.nextInt(i);
                arr[i] = arr[i] ^ arr[j];
                arr[j] = arr[i] ^ arr[j];
                arr[i] = arr[i] ^ arr[j];
            }
            return arr;
        }

        int[] uniq(int[] arr) {
            Arrays.sort(arr);
            int[] rv = new int[arr.length];
            int pos = 0;
            rv[pos++] = arr[0];
            for (int i = 1; i < arr.length; i++) {
                if (arr[i] != arr[i - 1]) {
                    rv[pos++] = arr[i];
                }
            }
            return Arrays.copyOf(rv, pos);
        }
    }
}


#include <iostream>
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
int64_t n,k;
int64_t sum;
int main(int argc, char const *argv[])
{
        int var;
        cin>>n>>k;
        vector<int> tab;//(n);
        for (int i=0; i<n; i++)
                cin>>var, tab.push_back(var);

        sort(tab.begin(),tab.end());

        for (int i=0; i<tab.size(); i++)
        {
                if (tab[i] == 0)
                        tab.erase(tab.begin()+i);
                else
                        break;
        }

        for(int i=0; i<k; i++)
        {
                if (i < tab.size()-1)
                {
                        if (tab[i]!=0)
                        {
                                sum += tab[i];
                                cout<<tab[i]<<endl;
                                tab[i+1]-=sum;
                        }
                        else
                        {tab[i+1]-=sum,k++; continue;}
                }
                else if (i==tab.size()-1)
                        cout<<tab[i]<<endl;
                else
                        cout<<0<<endl;

        }
        return 0;
}


#include <iostream>
#include<stdio.h>
#include<algorithm>
const int N=1.0e+5;

using namespace std;

int n,k;
int a[N+1];

int main()
{
    int i,j;
    int cnt=0;
    int dele;

    scanf("%d %d",&n,&k);

    for( i = 0 ; i < n ; i++){

        scanf("%d",&a[i]);

    }
    sort(a,a+n);

    while(k--){
        cnt=0;

        while(a[cnt]==0&&cnt<n){
            cnt++;
        }

        if(cnt>=n){
            printf("0\n");
            continue;
        }

        printf("%d\n",a[cnt]);
        dele=a[cnt];

        for(i=0;i<n;i++) {

            if(a[i]!=0) {
                a[i]=a[i]-dele;
            }
        }

    }

    return 0;
}


#include <iostream>
#include<stdio.h>
#include<algorithm>
const int N=1.0e+5;

using namespace std;

int n,k;
int a[N+1];
int b[N+1];

int main() {
    int i,j;
    int cnt=0;
 //   int dele;
    scanf("%d %d",&n,&k);
    for( i = 0 ; i < n ; i++) {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    b[cnt]=a[0];
    for( i = 1 ; i < n ; i++) {
        if(a[i]!=b[cnt]) {
            b[++cnt]=a[i];
        }
    }

    for( j = 0 ; j < k ; j++) {
        if(j>cnt) {
            printf("0\n");
            continue;
        }
        printf("%d\n",b[j]-b[j-1]);

    }
    return 0;
}


#include <iostream>
#include<stdio.h>
#include<algorithm>
const int N=1.0e+5;

using namespace std;

int n,k;
int a[N];
int lin;

int main()
{
    int i,j;
    int cnt=0;
    int dele;

    scanf("%d %d",&n,&k);

    for( i = 0 ; i < n ; i++){

        scanf("%d",&a[i]);

    }

    sort(a,a+n);

    while(k--){

        //cnt=0;

        while(a[lin]==0&&lin<n){
          //  cnt++;
            lin++;
        }

            if(lin>=n){
                printf("0\n");
                continue;
            }

        cnt=lin;
        printf("%d\n",a[cnt]);
        dele=a[cnt];

        for(i=cnt;i<n;i++) {
                if(a[i]!=0)
                a[i]=a[i]-dele;
        }

    }

    return 0;
}


#include <iostream>
#include<stdio.h>
#include<algorithm>
const int N=1.0e+5;

using namespace std;

int n,k;
int a[N];

int main() {
    int i,j;
    int cnt=0;
    int dele;

    scanf("%d %d",&n,&k);

    for( i = 0 ; i < n ; i++) {

        scanf("%d",&a[i]);

    }

    sort(a,a+n);

    while(k--) {

        while(a[cnt]==0&&cnt<n) {
            cnt++;
        }

        if(cnt>=n) {
            k++;
            while(k--){

                 printf("0\n");
            }

            break;
        }

        printf("%d\n",a[cnt]);
        dele=a[cnt];

        for(i=cnt; i<n; i++) {
            if(a[i]!=0)
                a[i]=a[i]-dele;
        }
    }
    return 0;
}


#include <iostream>
#include<stdio.h>
#include<algorithm>
const int N=1.0e+5;

using namespace std;

int n,k;
int a[N+1];
int lin;

int main()
{
    int i,j;
    int cnt=0;
    int dele;

    scanf("%d %d",&n,&k);

    for( i = 0 ; i < n ; i++){

        scanf("%d",&a[i]);

    }
    sort(a,a+n);

    while(k--){

        cnt=0;

        while(a[cnt]==0&&cnt<n){
            cnt++;
        }

        if(cnt!=0){

            lin=cnt-1;             //下标

            if(lin==n-1){
                printf("0\n");
                continue;
            }

        }

        printf("%d\n",a[cnt]);
        dele=a[cnt];

        for(i=cnt;i<n;i++) {
                if(a[i]!=0)
                a[i]=a[i]-dele;
        }

    }

    return 0;
}


#include <iostream>
#include<stdio.h>
#include<algorithm>
const int N=1.0e+5;

using namespace std;

int n,k;
int a[N+1];
int b[N+1];

int main() {
    int i,j;
    int cnt=0;
    int dele;
    scanf("%d %d",&n,&k);
    for( i = 0 ; i < n ; i++) {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);

      b[cnt]=a[0];

        for( i = 1 ; i < n ; i++){
                if(a[i]!=b[cnt]){
                    b[++cnt]=a[i];
                }
        }

        for( j = 0 ; j < k ; j++){

            if(j>cnt){

                printf("0\n");
                continue;

            }

            printf("%d\n",b[j]);

            for( i = j+1 ; i <= cnt ; i++){

                b[i]-=b[j];
            }

        }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
void quicksort(int a[], int left, int right)
{
    int chot=a[(right+left)/2];
    int i=left;
    int j=right;
    while (i<=j)
    {
        while(a[i]<chot)
            i++;
        while(a[j]>chot)
            j--;
        if(i<=j)
        {
            swap(a[i], a[j]);
            i++;
            j--;
        }
    }
    if(left<j)
        quicksort(a, left, j);
    if(right>i)
        quicksort(a, i, right);
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    quicksort(a, 0, n-1);

    cout<<a[0]<<endl;
    int dem=1;
    if(dem<k)
    {
        for(int i=1; i<n; i++)
        {
            if(a[i]>a[i-1])
            {
                cout<<a[i]-a[i-1]<<endl;
                dem++;
            }
        if(dem>=k)
            break;
        }
        for(int i=dem; i<k; i++)
            cout<<"0"<<endl;
    }

    return 0;
}


#include <iostream>

using namespace std;

void quicksort(int a[], int left , int right )
{
    if(left<right)
    {
        int i=left;
        int j=right;
        int mid= (left + right )/2 ;
        int k= a[mid];
        do
            {
                while(a[i]<k) i++;
                while (a[j]>k) j--;
                if(i<=j)
                {
                   int  tg=a[i];
                    a[i]=a[j];
                    a[j]=tg;
                    i++;
                    j--;

                }

            }
        while (i<=j);
        quicksort(a,left,j);
        quicksort(a,i,right);

    }

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    quicksort(a, 0, n-1);

    cout<<a[0]<<endl;
    int dem=1;

        for(int i=1; i<n; i++)
        {
            if(a[i]>a[i-1])
            {
                cout<<a[i]-a[i-1]<<endl;
                dem++;
            }
            if(dem>=k)
            break;
        }
        for(int i=dem; i<k; i++)
            cout<<"0"<<endl;
}


#include <bit/stdc++.h>

using namespace std;
void quicksort(int a[], int left, int right)
{
    int chot=a[(right+left)/2];
    int i=left;
    int j=right;
    while (i<=j)
    {
        while(a[i]<chot)
            i++;
        while(a[j]>chot)
            j--;
        if(i<=j)
        {
            swap(a[i], a[j]);
            i++;
            j--;
        }
    }
    if(left<j)
        quicksort(a, left, j);
    if(right>i)
        quicksort(a, i, right);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    quicksort(a, 0, n-1);

    cout<<a[0]<<endl;
    int dem=1;

        for(int i=1; i<n; i++)
        {
            if(a[i]>a[i-1])
            {
                cout<<a[i]-a[i-1]<<endl;
                dem++;
            }
            if(dem>=k)
            break;
        }
        for(int i=dem; i<k; i++)
            cout<<"0"<<endl;

    return 0;
}


#include <iostream>

using namespace std;
void quicksort(int a[], int left, int right)
{
    int chot=a[(right+left)/2];
    int i=left;
    int j=right;
    while (i<=j)
    {
        while(a[i]<chot)
            i++;
        while(a[j]>chot)
            j--;
        if(i<=j)
        {
            swap(a[i], a[j]);
            i++;
            j--;
        }
    }
    if(left<j)
        quicksort(a, left, j);
    if(right>i)
        quicksort(a, i, right);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    quicksort(a, 0, n-1);

    cout<<a[0]<<endl;
    int dem=1;

        for(int i=1; i<n; i++)
        {
            if(a[i]>a[i-1])
            {
                cout<<a[i]-a[i-1]<<endl;
                dem++;
            }
            if(dem>=k)
            break;
        }
        for(int i=dem; i<k; i++)
            cout<<"0"<<endl;

    return 0;
}


#include <iostream>

using namespace std;
void quicksort(int a[], int left , int right )
{
    if(left<right)
    {
        int i=left;
        int j=right;
        int mid= (left + right )/2 ;
        int k= a[mid];
        do
            {
                while(a[i]<k) i++;
                while (a[j]>k) j--;
                if(i<=j)
                {
                   int  tg=a[i];
                    a[i]=a[j];
                    a[j]=tg;
                    i++;
                    j--;

                }

            }
        while (i<=j);
        quicksort(a,left,j);
        quicksort(a,i,right);

    }

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    quicksort(a, 0, n-1);

    cout<<a[0]<<endl;
    int dem=1;

        for(int i=1; i<n; i++)
        {
            if(a[i]>a[i-1])
            {
                cout<<a[i]-a[i-1]<<endl;
                dem++;
            }
            if(dem>=k)
            break;
        }
        for(int i=dem; i<k; i++)
            cout<<"0"<<endl;
}


#include <iostream>

using namespace std;

void quicksort(int a[], int left , int right )
{
    if(left<right)
    {
        int i=left;
        int j=right;
        int mid= (left + right )/2 ;
        int k= a[mid];
        do
            {
                while(a[i]<k) i++;
                while (a[j]>k) j--;
                if(i<=j)
                {
                   int  tg=a[i];
                    a[i]=a[j];
                    a[j]=tg;
                    i++;
                    j--;

                }

            }
        while (i<=j);
        quicksort(a,left,j);
        quicksort(a,i,right);

    }

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    quicksort(a, 0, n-1);

    cout<<a[0]<<endl;
    int dem=1;

        for(int i=1; i<n; i++)
        {
            if(a[i]>a[i-1])
            {
                cout<<a[i]-a[i-1]<<endl;
                dem++;
            }
            if(dem>=k)
            break;
        }
        for(int i=dem; i<k; i++)
            cout<<"0"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
void quicksort(int a[], int left, int right)
{
    int chot=a[(right+left)/2];
    int i=left;
    int j=right;
    while (i<=j)
    {
        while(a[i]<chot)
            i++;
        while(a[j]>chot)
            j--;
        if(i<=j)
        {
            swap(a[i], a[j]);
            i++;
            j--;
        }
    }
    if(left<j)
        quicksort(a, left, j);
    if(right>i)
        quicksort(a, i, right);
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    quicksort(a, 0, n-1);

    cout<<a[0]<<endl;
    int dem=1;

        for(int i=1; i<n; i++)
        {
            if(a[i]>a[i-1])
            {
                cout<<a[i]-a[i-1]<<endl;
                dem++;
            }
            if(dem>=k)
            break;
        }
        for(int i=dem; i<k; i++)
            cout<<"0"<<endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {long long n1,m,n = 0;
cin>>n1>>m;
vector <long long> a(n1+m,0);
vector <long long> b(n1+m);
for (int i = 0;i < n1;i++)
    cin>>b[i];
sort(b.begin(),b.begin()+n1);
for (int i = 0;i < n1;i++)
    if (b[i]!=b[i+1]){a[n] = b[i];n++;}
sort(a.begin(),a.begin()+(n));
long long ans = 0;
while (ans<m)
{
    cout<<a[ans]<<endl;
    long long r = a[ans];
    for (int i = ans;i < n;i++)
        if (!(a[i]-r>0)) a[i] = 0;
    else a[i]-=r;
    ans++;
    if (ans>=n1)
    {
        long long ans1 = ans;
        for (int j = ans1;j<m;j++)
        cout<<a[n-1]<<endl;
        return 0;
    }
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n1,m,n = 0;
cin>>n1>>m;
vector <long long> a(n1+m,0);
vector <long long> b(n1+m);
for (int i = 0;i < n1;i++)
    cin>>b[i];
sort(b.begin(),b.begin()+n1);
for (int i = 0;i < n1;i++)
    if (b[i]!=b[i+1]){a[n] = b[i];n++;}
long long ans = 0;
while (ans<m)
{
    cout<<a[ans]<<endl;
    long long r = a[ans];
    a[ans] = 0;
    for (int i = ans+1;i < n;i++)
        a[i]-=r;
    ans++;
    if (ans==m) return 0;
    if (ans>=n1)
    {
        long long ans1 = ans;
        for (int j = ans1;j<m;j++)
        cout<<"0"<<endl;
        return 0;
    }
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {long long n,m;
cin>>n>>m;
vector <long long> a(n+m,0);
for (int i = 0;i < n;i++)
    cin>>a[i];
sort(a.begin(),a.begin()+n);
long long ans = 0;
while (ans!=(m))
{
    if ((a[ans]==0) && (a[ans+1]!=0)) cout<<a[ans+1]<<endl;
    else
    cout<<a[ans]<<endl;
    long long r = a[ans];
    for (int i = 0;i < n;i++)
        {if (a[i]-r<0) a[i] = 0;
        else a[i] = a[i] - r;
        //cout<<a[i]<<' ';
        }
        //cout<<endl;
        ans++;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n1,m,n = 0;
cin>>n1>>m;
vector <long long> a(n1+m,0);
vector <long long> b(n1+m);
for (int i = 0;i < n1;i++)
    cin>>b[i];
sort(b.begin(),b.begin()+n1);
for (int i = 0;i < n1;i++)
    if (b[i]!=b[i+1]){a[n] = b[i];n++;}
long long ans = 0;
/*while (ans<m)
{
    cout<<a[ans]<<endl;
    long long r = a[ans];
    a[ans] = 0;
    for (int i = ans+1;i < n;i++)
        a[i]-=r;
    ans++;
    if (ans==m) return 0;
    if (ans>=n1)
    {
        long long ans1 = ans;
        for (int j = ans1;j<m;j++)
        cout<<"0"<<endl;
        return 0;
    }
}*/
for (int q = 0; q < min(n,m);q++)
{
    cout<<a[ans]<<endl;
    long long r = a[ans];
    a[ans] = 0;
    for (int i = ans+1;i<n;i++)
        a[i] = a[i] - r;
    ans++;
}
if (ans<n) return 0;
else {for (int j = ans;j<m;j++)
    cout<<"0"<<endl;
    return 0;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {long long n1,m,n = 0;
cin>>n1>>m;
vector <long long> a(n1+m,0);
vector <long long> b(n1+m);
for (int i = 0;i < n1;i++)
    cin>>b[i];
sort(b.begin(),b.begin()+n1);
for (int i = 0;i < n1;i++)
    if (b[i]!=b[i+1]){a[n] = b[i];n++;}
sort(a.begin(),a.begin()+(n));
long long ans = 0;
while (ans<m)
{
    cout<<a[ans]<<endl;
    long long r = a[ans];
    for (int i = 0;i < n;i++)
        if (!(a[i]-r>0)) a[i] = 0;
    else a[i]-=r;
    ans++;
    if (ans>=n1)
    {
        long long ans1 = ans;
        for (int j = ans1;j<m;j++)
        cout<<a[n-1]<<endl;
        return 0;
    }
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {long long n,m;
cin>>n>>m;
vector <long long> a(n+m);
for (int i = 0;i < n;i++)
    cin>>a[i];
for (int j = 0;j < m;j++)
{
    long long tr = 1e9;
    for (int i  =0;i < n;i++)
        if (a[i]>0) tr = min(tr,a[i]);
    if (tr!=1e9) cout<<tr<<endl;
    else cout<<0<<endl;
    for (int i = 0;i < n;i++)
        if (a[i]-tr<0) a[i] = 0;
    else a[i] = a[i] - tr;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n1,m,n = 0;
cin>>n1>>m;
vector <long long> a(n1+m,0);
vector <long long> b(n1+m);
for (int i = 0;i < n1;i++)
    cin>>b[i];
sort(b.begin(),b.begin()+n1);
for (int i = 0;i < n1;i++)
    if (b[i]!=b[i+1]){a[n] = b[i];n++;}
long long ans = 0;
for (int i = 0;i < n;i++)
{
        cout<<a[i]-ans<<endl;
        ans += a[i] - ans;
        if (i==(m-1)) return 0;
    }
for (int i = n;i<m;i++)
    cout<<"0"<<endl;
return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n1,m,n = 0;
cin>>n1>>m;
vector <long long> a(n1+m,0);
vector <long long> b(n1+m);
for (int i = 0;i < n1;i++)
    cin>>b[i];
sort(b.begin(),b.begin()+n1);
for (int i = 0;i < n1;i++)
    if (b[i]!=b[i+1]){a[n] = b[i];n++;}
sort(a.begin(),a.begin()+(n));
long long ans = 0;
while (ans<m)
{
    cout<<a[ans]<<endl;
    long long r = a[ans];
    a[ans] = 0;
    for (int i = ans+1;i < n;i++)
        a[i]-=r;
    ans++;
    if (ans==m) return 0;
    if (ans>=n1)
    {
        long long ans1 = ans;
        for (int j = ans1;j<m;j++)
        cout<<"0"<<endl;
        return 0;
    }
}
return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, k, pos = 0;
bool p;

int main() {
	//...
	ios::sync_with_stdio(false);
	cin >> n >> k;

	vector <int> d(n);
	for (int i(0); i < n; i++)
		cin >> d[i];

	sort(d.begin(), d.end());

	for (int i(0); i < k; i++) {
		int mn(d[pos]);
		p = false;

		cout << mn << endl; // вывели минимальный

		for (int j(pos); j < n; j++) {
			d[j] -= mn;

			if (d[j] && !p) {
				pos = j;
				p = true; // нашли след. минимальный элемент
			}
		}
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, m;

int main() {
	//...
	cin >> n >> m;

	vector <int> d(n);
	for (int i(0); i < n; i++)
		cin >> d[i];

	sort(d.begin(), d.end());

	//___
	int inc(0);
	for (int i(0), o(0); o != m; o++) {
		if (i != n - 1) {
			while (d[i + 1] == d[i] && i < n-1) {
				i++;
			}
		}

		cout << (d[i]-inc > 0 ? d[i]-inc : 0) << endl;

		inc += (d[i]-inc);

		if (i != n - 1)
			i++;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, k, pos = 0;
bool p;

int main() {
	//...
	cin >> n >> k;

	if (n == k) {
		for (int i(0); i < k; i++)
			cout << 1 << endl;

		return 0;
	}

	vector <int> d(n);
	for (int i(0); i < n; i++)
		cin >> d[i];

	sort(d.begin(), d.end());

	for (int i(0); i < k; i++) {
		int mn(d[pos]);
		p = false;

		cout << mn << endl; // вывели минимальный

		for (int j(pos); j < n; j++) {
			d[j] -= mn;

			if (d[j] && !p) {
				pos = j;
				p = true; // нашли след. минимальный элемент
			}
		}
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, k;

// найти минимальный ненулевой элемент и вычесть его из всех (включая себя)
void operation(vector <int> &p) {
	// находим ненулевой минимальный элемент, затем его выводим
	int mn(99999);
	for (int i(0); i < p.size(); i++)
		if (p[i])
			mn = min(mn, p[i]);

	cout << (mn == 99999 ? 0 : mn) << endl; // вывести минимальный элемент

	// если все элементы уже нули
	if (mn == 99999)
		return;

	// вычитаем из каждого положительного минимальный элемент
	for (int i(0); i < p.size(); i++)
		if (p[i] > 0)
			p[i] -= mn;
}

int main() {
	// ...
	cin >> n >> k;

	vector <int> d(n);
	for (int i(0); i < n; i++)
		cin >> d[i];

	//____
	while (k) {
		operation(d); // все делает функция
		k--;
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, k, pos = 0;
bool p;

int main() {
	//...
	cin >> n >> k;

	vector <int> d(n);
	for (int i(0); i < n; i++)
		cin >> d[i];

	sort(d.begin(), d.end());

	for (int i(0); i < k; i++) {
		if (pos == n - 1 && d[pos] == 0) {
			cout << 0 << endl;
			continue;
		}

		int mn(d[pos]);
		p = false;

		cout << mn << endl; // вывели минимальный

		for (int j(pos); j < n; j++) {
			d[j] -= mn;

			if (d[j] && !p) {
				pos = j;
				p = true; // нашли след. минимальный элемент
			}
		}
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, k, pos = 0;
bool p;

int main() {
	//...
	cin >> n >> k;

	vector <int> d(n);
	for (int i(0); i < n; i++)
		cin >> d[i];

	sort(d.begin(), d.end());

	for (int i(0); i < k; i++) {
		int mn(d[pos]);
		p = false;

		cout << mn << endl; // вывели минимальный

		for (int j(pos); j < n; j++) {
			d[j] -= mn;

			if (d[j] && !p) {
				pos = j;
				p = true; // нашли след. минимальный элемент
			}
		}
	}

	return 0;
}


#pragma GCC optimize ("Ofast")
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int x;
    multiset<int> a;
    for (int j = 0; j < n; j++) {
        cin >> x;
        a.insert(x);
    }
    int i = 0;
    for (int j = 0; j < k; j++) {
        auto it = upper_bound(a.begin(), a.end(), i);
       // cout << *it << ' ' << endl;
        if (it != a.end()) {
            cout << *it - i << endl;
            i = *it;
        } else {
            while (j < k) {
                cout << 0 << endl;
                j++;
            }
            return 0;
        }
    }
    return 0;
}


#pragma GCC optimize ("Ofast")
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int x;
    multiset<int> a;
    for (int j = 0; j < n; j++) {
        cin >> x;
        a.insert(x);
    }
    int i = 0;
    for (int j = 0; j < k; j++) {
        auto it = a.begin();
        while (*it <= i && it != a.end()) {
            it++;
        }
        if (it != a.end()) {
            cout << *it - i << endl;
            i = *it;
        } else {
            while (j < k) {
                cout << 0 << endl;
                j++;
            }
            return 0;
        }
    }
    return 0;
}


#pragma GCC optimize ("Ofast")
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int x;
    set<int> a;
    for (int j = 0; j < n; j++) {
        cin >> x;
        a.insert(x);
    }
    int i = 0;
    for (int j = 0; j < k; j++) {
        auto it = upper_bound(a.begin(), a.end(), i);
       // cout << *it << ' ' << endl;
        if (it != a.end()) {
            cout << *it - i << endl;
            i = *it;
        } else {
            while (j < k) {
                cout << 0 << endl;
                j++;
            }
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    int x;
    multiset<int> a;
    for (int j = 0; j < n; j++) {
        cin >> x;
        a.insert(x);
    }
    int i = 0;
    for (int j = 0; j < k; j++) {
        auto it = a.begin();
        while (*it <= i && it != a.end()) {
            it++;
        }
        if (it != a.end()) {
            cout << *it - i << endl;
            i = *it;
        } else {
            while (j < k) {
                cout << 0 << endl;
                j++;
            }
            return 0;
        }
    }
    return 0;
}


#pragma GCC optimize ("Ofast")
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int x;
    set<int> a;
    for (int j = 0; j < n; j++) {
        cin >> x;
        a.insert(x);
    }
    int i = 0;
    for (int j = 0; j < k; j++) {
        auto it = a.upper_bound(i);
       // cout << *it << ' ' << endl;
        if (it != a.end()) {
            cout << *it - i << '\n';
            i = *it;
        } else {
            while (j < k) {
                cout << 0 << '\n';
                j++;
            }
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    int x;
    multiset<int> a;
    for (int j = 0; j < n; j++) {
        cin >> x;
        a.insert(x);
    }

    for (int j = 0; j < k; j++) {
        auto it = a.begin();
        while (*it <= j && it != a.end()) {
            it++;
        }
        if (it != a.end()) {
            cout << *it - j << endl;
        } else {
            while (j < k) {
                cout << 0 << endl;
                j++;
            }
            return 0;
        }
    }
    return 0;
}


/* C program for Merge Sort */
#include<stdlib.h>
#include<stdio.h>

// Merges two subarrays of arr[].
// First subarray is arr[l..m]
// Second subarray is arr[m+1..r]
void merge(long long int arr[], long long int l, long long int m, long long int r)
{
	long long int i, j, k;
	long long int n1 = m - l + 1;
	long long int n2 =  r - m;

	/* create temp arrays */
	long long int L[n1], R[n2];

	/* Copy data to temp arrays L[] and R[] */
	for (i = 0; i < n1; i++)
		L[i] = arr[l + i];
	for (j = 0; j < n2; j++)
		R[j] = arr[m + 1+ j];

	/* Merge the temp arrays back into arr[l..r]*/
	i = 0; // Initial index of first subarray
	j = 0; // Initial index of second subarray
	k = l; // Initial index of merged subarray
	while (i < n1 && j < n2)
	{
		if (L[i] <= R[j])
		{
			arr[k] = L[i];
			i++;
		}
		else
		{
			arr[k] = R[j];
			j++;
		}
		k++;
	}

	/* Copy the remaining elements of L[], if there
	   are any */
	while (i < n1)
	{
		arr[k] = L[i];
		i++;
		k++;
	}

	/* Copy the remaining elements of R[], if there
	   are any */
	while (j < n2)
	{
		arr[k] = R[j];
		j++;
		k++;
	}
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long long int arr[], long long int l, long long int r)
{
	if (l < r)
	{
		// Same as (l+r)/2, but avoids overflow for
		// large l and h
		int m = l+(r-l)/2;

		// Sort first and second halves
		mergeSort(arr, l, m);
		mergeSort(arr, m+1, r);

		merge(arr, l, m, r);
	}
}

int main()
{
	long long int n,k;
	scanf("%lld %lld",&n,&k);
	long long int a[n],sum=0,count=0,count1=0;
	for(long long int i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
	}
	mergeSort(a,0,n-1);
	if(n<k)
	{
		for(long long int i=0;i<100000;i++)
		{
			if(a[i]!=0)
			{
				printf("%lld\n",a[i]);
				sum+=a[i];
			//	a[i+1]=a[i+1]-sum;
				count1++;
			}
			a[i+1]=a[i+1]-sum;
			count++;

			if(count==n)
				break;

			//if(a[n]==0)
		//	{
		//		printf("%lld\n",a[n]);
		//		break;
		//	}
		}
	}
	if(k<n)
	{
		for(long long int i=0;i<100000;i++)
		{
			if(a[i]!=0)
			{
				printf("%lld\n",a[i]);
				sum+=a[i];
			//	a[i+1]=a[i+1]-sum;
				count1++;
			}
			a[i+1]=a[i+1]-sum;
			count++;

			if(count1==k)
				break;

		//	if(a[n]==0)
		//	{
		//		printf("%lld\n",a[n]);
		//		break;
		//	}
		}
	}

	if(k>count1)
	{
	//	printf("enter\n");
		for(long long int i=0;i<k-count1;i++)
		{
			printf("0\n");
		}
	}
}


/* C program for Merge Sort */
#include<stdlib.h>
#include<stdio.h>

// Merges two subarrays of arr[].
// First subarray is arr[l..m]
// Second subarray is arr[m+1..r]
void merge(long long int arr[], long long int l, long long int m, long long int r)
{
	long long int i, j, k;
	long long int n1 = m - l + 1;
	long long int n2 =  r - m;

	/* create temp arrays */
	long long int L[n1], R[n2];

	/* Copy data to temp arrays L[] and R[] */
	for (i = 0; i < n1; i++)
		L[i] = arr[l + i];
	for (j = 0; j < n2; j++)
		R[j] = arr[m + 1+ j];

	/* Merge the temp arrays back into arr[l..r]*/
	i = 0; // Initial index of first subarray
	j = 0; // Initial index of second subarray
	k = l; // Initial index of merged subarray
	while (i < n1 && j < n2)
	{
		if (L[i] <= R[j])
		{
			arr[k] = L[i];
			i++;
		}
		else
		{
			arr[k] = R[j];
			j++;
		}
		k++;
	}

	/* Copy the remaining elements of L[], if there
	   are any */
	while (i < n1)
	{
		arr[k] = L[i];
		i++;
		k++;
	}

	/* Copy the remaining elements of R[], if there
	   are any */
	while (j < n2)
	{
		arr[k] = R[j];
		j++;
		k++;
	}
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long long int arr[], long long int l, long long int r)
{
	if (l < r)
	{
		// Same as (l+r)/2, but avoids overflow for
		// large l and h
		int m = l+(r-l)/2;

		// Sort first and second halves
		mergeSort(arr, l, m);
		mergeSort(arr, m+1, r);

		merge(arr, l, m, r);
	}
}

int main()
{
	long long int n,k;
	scanf("%lld %lld",&n,&k);
	long long int a[n],sum=0,count=0,count1=0;
	for(long long int i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
	}
	mergeSort(a,0,n-1);
	if(n<=k)
	{
		for(long long int i=0;i<100000;i++)
		{
			if(a[i]!=0)
			{
				printf("%lld\n",a[i]);
				sum+=a[i];
			//	a[i+1]=a[i+1]-sum;
				count1++;
			}
			a[i+1]=a[i+1]-sum;
			count++;

			if(count==n)
				break;

			//if(a[n]==0)
		//	{
		//		printf("%lld\n",a[n]);
		//		break;
		//	}
		}
	}
	if(k<n)
	{
		for(long long int i=0;i<100000;i++)
		{
			if(a[i]!=0)
			{
				printf("%lld\n",a[i]);
				sum+=a[i];
			//	a[i+1]=a[i+1]-sum;
				count1++;
			}
			a[i+1]=a[i+1]-sum;
			count++;

			if(count1==k)
				break;

		//	if(a[n]==0)
		//	{
		//		printf("%lld\n",a[n]);
		//		break;
		//	}
		}
	}

	if(k>count1)
	{
	//	printf("enter\n");
		for(long long int i=0;i<k-count1;i++)
		{
			printf("0\n");
		}
	}
}


#include<stdio.h>
int main()
{
	long long int n,k;
	scanf("%lld %lld",&n,&k);
	long long int a[n];
	for(int i=0;i<n;i++)
		scanf("%lld",&a[i]);
//	long long int min=a[0];
	for(int j=0;j<k;j++)
	{
		long long int count=0,min;
		for(int i=0;i<n;i++)
			if(a[i]!=0)
			{
				min=a[i];
				break;
			}
		for(int i=0;i<n;i++)
		{
			if(min>a[i] && a[i]>0)
				min=a[i];
		}
		if(min>0)
		printf("%lld\n",min);
		for(int i=0;i<n;i++)
		{
			a[i]=a[i]-min;
//			printf("%d\n",a[i]);
		}
//		printf("\n");
/*		for(int i=0;i<n;i++)
		{
			if(a[i]==0)
				count++;
		}
		if(count==n)
		{
			printf("0\n");
			break;
		}*/
	}
	if(k>n)
	{
		for(int i=0;i<k-n;i++)
			printf("0\n");
	}
}


/* C program for Merge Sort */
#include<stdlib.h>
#include<stdio.h>

// Merges two subarrays of arr[].
// First subarray is arr[l..m]
// Second subarray is arr[m+1..r]
void merge(long long int arr[], long long int l, long long int m, long long int r)
{
        long long int i, j, k;
        long long int n1 = m - l + 1;
        long long int n2 =  r - m;

        /* create temp arrays */
        long long int L[n1], R[n2];

        /* Copy data to temp arrays L[] and R[] */
        for (i = 0; i < n1; i++)
                L[i] = arr[l + i];
        for (j = 0; j < n2; j++)
                R[j] = arr[m + 1+ j];

        /* Merge the temp arrays back into arr[l..r]*/
        i = 0; // Initial index of first subarray
        j = 0; // Initial index of second subarray
        k = l; // Initial index of merged subarray
        while (i < n1 && j < n2)
        {
                if (L[i] <= R[j])
                {
                        arr[k] = L[i];
                        i++;
                }
                else
                {
                        arr[k] = R[j];
                        j++;
                }
                k++;
        }

        /* Copy the remaining elements of L[], if there
           are any */
        while (i < n1)
        {
                arr[k] = L[i];
                i++;
                k++;
        }

        /* Copy the remaining elements of R[], if there
           are any */
        while (j < n2)
        {
                arr[k] = R[j];
                j++;
                k++;
        }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long long int arr[], long long int l, long long int r)
{
        if (l < r)
        {
                // Same as (l+r)/2, but avoids overflow for
                // large l and h
                int m = l+(r-l)/2;

                // Sort first and second halves
                mergeSort(arr, l, m);
                mergeSort(arr, m+1, r);

                merge(arr, l, m, r);
        }
}

int main()
{
        long long int n,k;
        scanf("%lld %lld",&n,&k);
        long long int a[n],sum=0,min;
        for(long long int i=0;i<n;i++)
        {
                scanf("%lld",&a[i]);
        }
        mergeSort(a,0,n-1);
        while(k--)
	{
		for(int i=0;i<n;i++)
		{
			if(a[i]!=0)
			{
				min=a[i];
				sum=1;
				break;
			}
		}
		if(sum==0)
		{
			printf("0\n");
		}
		else
		{
			printf("%lld\n",min);
			for(int i=0;i<n;i++)
			{
				if(a[i]!=0)
					a[i]=a[i]-min;
			}
			sum=0;
		}
	}

}


/* C program for Merge Sort */
#include<stdlib.h>
#include<stdio.h>

// Merges two subarrays of arr[].
// First subarray is arr[l..m]
// Second subarray is arr[m+1..r]
void merge(long long int arr[], long long int l, long long int m, long long int r)
{
	long long int i, j, k;
	long long int n1 = m - l + 1;
	long long int n2 =  r - m;

	/* create temp arrays */
	long long int L[n1], R[n2];

	/* Copy data to temp arrays L[] and R[] */
	for (i = 0; i < n1; i++)
		L[i] = arr[l + i];
	for (j = 0; j < n2; j++)
		R[j] = arr[m + 1+ j];

	/* Merge the temp arrays back into arr[l..r]*/
	i = 0; // Initial index of first subarray
	j = 0; // Initial index of second subarray
	k = l; // Initial index of merged subarray
	while (i < n1 && j < n2)
	{
		if (L[i] <= R[j])
		{
			arr[k] = L[i];
			i++;
		}
		else
		{
			arr[k] = R[j];
			j++;
		}
		k++;
	}

	/* Copy the remaining elements of L[], if there
	   are any */
	while (i < n1)
	{
		arr[k] = L[i];
		i++;
		k++;
	}

	/* Copy the remaining elements of R[], if there
	   are any */
	while (j < n2)
	{
		arr[k] = R[j];
		j++;
		k++;
	}
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long long int arr[], long long int l, long long int r)
{
	if (l < r)
	{
		// Same as (l+r)/2, but avoids overflow for
		// large l and h
		int m = l+(r-l)/2;

		// Sort first and second halves
		mergeSort(arr, l, m);
		mergeSort(arr, m+1, r);

		merge(arr, l, m, r);
	}
}

int main()
{
	long long int n,k;
	scanf("%lld %lld",&n,&k);
	long long int a[n],sum=0,count=0;
	for(long long int i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
	}
	mergeSort(a,0,n-1);
	if(n<k)
	{
		for(long long int i=0;i<100000;i++)
		{
			if(a[i]!=0)
			{
				printf("%lld\n",a[i]);
				sum+=a[i];
			//	a[i+1]=a[i+1]-sum;
				count++;
			}
			a[i+1]=a[i+1]-sum;

			if(count==n)
				break;
		}
	}
	if(k<n)
	{
		for(long long int i=0;i<100000;i++)
		{
			if(a[i]!=0)
			{
				printf("%lld\n",a[i]);
				sum+=a[i];
			//	a[i+1]=a[i+1]-sum;
				count++;
			}
			a[i+1]=a[i+1]-sum;

			if(count==k)
				break;
		}
	}

	if(k>n)
	{
		for(long long int i=0;i<k-n;i++)
			printf("0\n");
	}
}