import java.io.*;

public class Main {
    public static void main(String[] args) {
        int[][] cij = new int[3][];

        try (InputScanner is = new InputScanner(System.in)) {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        }
        boolean con1 = (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]);
        boolean con2 = (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]);
        boolean con3 = (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]);
        boolean con4 = (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]);

        boolean con5 = (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]);
        boolean con6 = (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]);

        boolean con7 = (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]);
        boolean con8 = (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]);

        if (con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

    //-------------------------------------------------------------------
    public static class InputScanner implements Closeable {
        private final BufferedReader br;
        private String[] element;
        private int elementIndex;

        public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            return this.nextElement();
        }

        //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        }

        //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        }

        //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        }

        private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        }

        private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        }

        private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        }

        @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
//-------------------------------------------------------------------
} import java.io.*; io.* java public class Main {
    public static void main(String[] args) {
        int[][] cij = new int[3][];

        try (InputScanner is = new InputScanner(System.in)) {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        }
        boolean con1 = (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]);
        boolean con2 = (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]);
        boolean con3 = (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]);
        boolean con4 = (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]);

        boolean con5 = (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]);
        boolean con6 = (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]);

        boolean con7 = (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]);
        boolean con8 = (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]);

        if (con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

    //-------------------------------------------------------------------
    public static class InputScanner implements Closeable {
        private final BufferedReader br;
        private String[] element;
        private int elementIndex;

        public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            return this.nextElement();
        }

        //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        }

        //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        }

        //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        }

        private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        }

        private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        }

        private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        }

        @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
//-------------------------------------------------------------------
} Main public static void main(String[] args) {
        int[][] cij = new int[3][];

        try (InputScanner is = new InputScanner(System.in)) {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        }
        boolean con1 = (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]);
        boolean con2 = (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]);
        boolean con3 = (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]);
        boolean con4 = (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]);

        boolean con5 = (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]);
        boolean con6 = (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]);

        boolean con7 = (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]);
        boolean con8 = (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]);

        if (con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    } main {
        int[][] cij = new int[3][];

        try (InputScanner is = new InputScanner(System.in)) {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        }
        boolean con1 = (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]);
        boolean con2 = (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]);
        boolean con3 = (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]);
        boolean con4 = (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]);

        boolean con5 = (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]);
        boolean con6 = (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]);

        boolean con7 = (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]);
        boolean con8 = (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]);

        if (con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    } int[][] cij = new int[3][]; cij new int[3][] 3 try (InputScanner is = new InputScanner(System.in)) {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        } {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        } InputScanner is = new InputScanner(System.in) InputScanner is = new InputScanner(System.in) new InputScanner(System.in) cij[0] = is.nia(3) cij[0] cij 0 is.nia(3) is.nia is 3 cij[1] = is.nia(3) cij[1] cij 1 is.nia(3) is.nia is 3 cij[2] = is.nia(3) cij[2] cij 2 is.nia(3) is.nia is 3 boolean con1 = (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]); con1 (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]) (cij[1][0] - cij[1][1]) cij[1][0] cij[1] cij 1 0 cij[1][1] cij[1] cij 1 1 (cij[0][0] - cij[0][1]) cij[0][0] cij[0] cij 0 0 cij[0][1] cij[0] cij 0 1 boolean con2 = (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]); con2 (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]) (cij[2][0] - cij[2][1]) cij[2][0] cij[2] cij 2 0 cij[2][1] cij[2] cij 2 1 (cij[0][0] - cij[0][1]) cij[0][0] cij[0] cij 0 0 cij[0][1] cij[0] cij 0 1 boolean con3 = (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]); con3 (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]) (cij[1][0] - cij[1][2]) cij[1][0] cij[1] cij 1 0 cij[1][2] cij[1] cij 1 2 (cij[0][0] - cij[0][2]) cij[0][0] cij[0] cij 0 0 cij[0][2] cij[0] cij 0 2 boolean con4 = (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]); con4 (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]) (cij[2][0] - cij[2][2]) cij[2][0] cij[2] cij 2 0 cij[2][2] cij[2] cij 2 2 (cij[0][0] - cij[0][2]) cij[0][0] cij[0] cij 0 0 cij[0][2] cij[0] cij 0 2 boolean con5 = (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]); con5 (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]) (cij[0][1] - cij[1][1]) cij[0][1] cij[0] cij 0 1 cij[1][1] cij[1] cij 1 1 (cij[0][0] - cij[1][0]) cij[0][0] cij[0] cij 0 0 cij[1][0] cij[1] cij 1 0 boolean con6 = (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]); con6 (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]) (cij[0][2] - cij[1][2]) cij[0][2] cij[0] cij 0 2 cij[1][2] cij[1] cij 1 2 (cij[0][0] - cij[1][0]) cij[0][0] cij[0] cij 0 0 cij[1][0] cij[1] cij 1 0 boolean con7 = (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]); con7 (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]) (cij[0][1] - cij[2][1]) cij[0][1] cij[0] cij 0 1 cij[2][1] cij[2] cij 2 1 (cij[0][0] - cij[2][0]) cij[0][0] cij[0] cij 0 0 cij[2][0] cij[2] cij 2 0 boolean con8 = (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]); con8 (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]) (cij[0][2] - cij[2][2]) cij[0][2] cij[0] cij 0 2 cij[2][2] cij[2] cij 2 2 (cij[0][0] - cij[2][0]) cij[0][0] cij[0] cij 0 0 cij[2][0] cij[2] cij 2 0 if (con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8 con7 con6 con5 con4 con3 con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8 con1 con2 con3 con4 con5 con6 con7 con8 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public static class InputScanner implements Closeable {
        private final BufferedReader br;
        private String[] element;
        private int elementIndex;

        public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            return this.nextElement();
        }

        //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        }

        //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        }

        //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        }

        private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        }

        private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        }

        private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        }

        @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    } InputScanner private final BufferedReader br; br private String[] element; element private int elementIndex; elementIndex public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        } InputScanner {
            this.br = new BufferedReader(new InputStreamReader(is));
        } this.br = new BufferedReader(new InputStreamReader(is)) this.br this this.br new BufferedReader(new InputStreamReader(is)) InputStream is is public String next() {
            return this.nextElement();
        } next {
            return this.nextElement();
        } return this.nextElement(); this.nextElement() this.nextElement this //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        } ni {
            return Integer.parseInt(this.nextElement());
        } return Integer.parseInt(this.nextElement()); Integer.parseInt(this.nextElement()) Integer.parseInt Integer this.nextElement() this.nextElement this //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        } li {
            return Long.parseLong(this.nextElement());
        } return Long.parseLong(this.nextElement()); Long.parseLong(this.nextElement()) Long.parseLong Long this.nextElement() this.nextElement this //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        } nia {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        } int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                arr[i] = this.ni();
            } {
                arr[i] = this.ni();
            } arr[i] = this.ni() arr[i] arr i this.ni() this.ni this return arr; arr int n n private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        } readLine {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        } try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                this.element = this.br.readLine().split("\\s");
            } this.element = this.br.readLine().split("\\s") this.element this this.element this.br.readLine().split("\\s") this.br.readLine().split this.br.readLine() this.br.readLine this.br this this.br "\\s" this.elementIndex = 0 this.elementIndex this this.elementIndex 0 private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        } nextElement {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        } if (!hasElement()) {
                this.readLine();
            } !hasElement() hasElement() hasElement {
                this.readLine();
            } this.readLine() this.readLine this return this.element[this.elementIndex++]; this.element[this.elementIndex++] this.element this this.element this.elementIndex++ this.elementIndex this this.elementIndex private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        } hasElement {
            return this.element != null && this.element.length > this.elementIndex;
        } return this.element != null && this.element.length > this.elementIndex; this.element != null && this.element.length > this.elementIndex this.element != null this.element this this.element null this.element.length > this.elementIndex this.element.length this.element this this.element this.element.length this.elementIndex this this.elementIndex @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        } close {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        } if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } this.br != null this.br this this.br null {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    this.br.close();
                } this.br.close() this.br.close this.br this this.br Closeable public class Main {
    public static void main(String[] args) {
        int[][] cij = new int[3][];

        try (InputScanner is = new InputScanner(System.in)) {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        }
        boolean con1 = (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]);
        boolean con2 = (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]);
        boolean con3 = (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]);
        boolean con4 = (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]);

        boolean con5 = (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]);
        boolean con6 = (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]);

        boolean con7 = (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]);
        boolean con8 = (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]);

        if (con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

    //-------------------------------------------------------------------
    public static class InputScanner implements Closeable {
        private final BufferedReader br;
        private String[] element;
        private int elementIndex;

        public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            return this.nextElement();
        }

        //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        }

        //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        }

        //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        }

        private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        }

        private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        }

        private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        }

        @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
//-------------------------------------------------------------------
} public class Main {
    public static void main(String[] args) {
        int[][] cij = new int[3][];

        try (InputScanner is = new InputScanner(System.in)) {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        }
        boolean con1 = (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]);
        boolean con2 = (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]);
        boolean con3 = (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]);
        boolean con4 = (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]);

        boolean con5 = (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]);
        boolean con6 = (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]);

        boolean con7 = (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]);
        boolean con8 = (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]);

        if (con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

    //-------------------------------------------------------------------
    public static class InputScanner implements Closeable {
        private final BufferedReader br;
        private String[] element;
        private int elementIndex;

        public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            return this.nextElement();
        }

        //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        }

        //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        }

        //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        }

        private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        }

        private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        }

        private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        }

        @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
//-------------------------------------------------------------------
} Main
import java.io.*;

public class Main {
    public static void main(String[] args) {
        int[][] cij = new int[3][];

        try (InputScanner is = new InputScanner(System.in)) {
            cij[0] = is.nia(3);
            cij[1] = is.nia(3);
            cij[2] = is.nia(3);
        }
        boolean con1 = (cij[1][0] - cij[1][1]) == (cij[0][0] - cij[0][1]);
        boolean con2 = (cij[2][0] - cij[2][1]) == (cij[0][0] - cij[0][1]);
        boolean con3 = (cij[1][0] - cij[1][2]) == (cij[0][0] - cij[0][2]);
        boolean con4 = (cij[2][0] - cij[2][2]) == (cij[0][0] - cij[0][2]);

        boolean con5 = (cij[0][1] - cij[1][1]) == (cij[0][0] - cij[1][0]);
        boolean con6 = (cij[0][2] - cij[1][2]) == (cij[0][0] - cij[1][0]);

        boolean con7 = (cij[0][1] - cij[2][1]) == (cij[0][0] - cij[2][0]);
        boolean con8 = (cij[0][2] - cij[2][2]) == (cij[0][0] - cij[2][0]);

        if (con1 && con2 && con3 && con4 && con5 && con6 && con7 && con8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

    //-------------------------------------------------------------------
    public static class InputScanner implements Closeable {
        private final BufferedReader br;
        private String[] element;
        private int elementIndex;

        public InputScanner(InputStream is) {
            this.br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            return this.nextElement();
        }

        //next int
        public int ni() {
            return Integer.parseInt(this.nextElement());
        }

        //next long
        public long li() {
            return Long.parseLong(this.nextElement());
        }

        //next int array
        public int[] nia(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.ni();
            }
            return arr;
        }

        private void readLine() {
            try {
                this.element = this.br.readLine().split("\\s");
            } catch (IOException e) {
                e.printStackTrace();
            }
            this.elementIndex = 0;
        }

        private String nextElement() {
            if (!hasElement()) {
                this.readLine();
            }
            return this.element[this.elementIndex++];
        }

        private boolean hasElement() {
            return this.element != null && this.element.length > this.elementIndex;
        }

        @Override
        public void close() {
            if (this.br != null) {
                try {
                    this.br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
//-------------------------------------------------------------------
}
