Problem: Vasya had two arrays consisting of non-negative integers: a of size n and b of size m. Vasya chose a positive integer k and created an n × m matrix v using the following formula:

<image>

Vasya wrote down matrix v on a piece of paper and put it in the table.

A year later Vasya was cleaning his table when he found a piece of paper containing an n × m matrix w. He remembered making a matrix one day by the rules given above but he was not sure if he had found the paper with the matrix v from those days. Your task is to find out if the matrix w that you've found could have been obtained by following these rules and if it could, then for what numbers k, a1, a2, ..., an, b1, b2, ..., bm it is possible.

Input

The first line contains integers n and m (1 ≤ n, m ≤ 100), separated by a space — the number of rows and columns in the found matrix, respectively. 

The i-th of the following lines contains numbers wi, 1, wi, 2, ..., wi, m (0 ≤ wi, j ≤ 109), separated by spaces — the elements of the i-th row of matrix w.

Output

If the matrix w could not have been obtained in the manner described above, print "NO" (without quotes) in the single line of output.

Otherwise, print four lines.

In the first line print "YES" (without quotes).

In the second line print an integer k (1 ≤ k ≤ 1018). Note that each element of table w should be in range between 0 and k - 1 inclusively.

In the third line print n integers a1, a2, ..., an (0 ≤ ai ≤ 1018), separated by spaces.

In the fourth line print m integers b1, b2, ..., bm (0 ≤ bi ≤ 1018), separated by spaces.

Examples

Input

2 3
1 2 3
2 3 4


Output

YES
1000000007
0 1 
1 2 3 

Input

2 2
1 2
2 0


Output

YES
3
0 1 
1 2 

Input

2 2
1 2
2 1


Output

NO

Note

By <image> we denote the remainder of integer division of b by c.

It is guaranteed that if there exists some set of numbers k, a1, ..., an, b1, ..., bm, that you could use to make matrix w, then there also exists a set of numbers that meets the limits 1 ≤ k ≤ 1018, 1 ≤ ai ≤ 1018, 1 ≤ bi ≤ 1018 in the output format. In other words, these upper bounds are introduced only for checking convenience purposes.

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.StringTokenizer;

public class _509D {

    static int r, c;
    static long[][] matrix;

    static long k = -1;

    static boolean check(Set<Long> set) {
        if (set.size() > 2) return false;
        if (set.size() == 2) {
            Iterator<Long> iterator = set.iterator();
            long x = iterator.next();
            long y = iterator.next();

            if (x == 0 && y != 0 || x != 0 && y == 0) return false;
            if (Long.signum(x) * Long.signum(y) < 0) {
                long newK = Math.abs(x - y);
                if (k == -1) k = newK;
                else if (k != newK) return false;
            } else return false;
        }
        return true;
    }

    static boolean doit() {
        long max = Integer.MIN_VALUE;
        for (long[] arr : matrix)
            for (long num : arr)
                max = Math.max(max, num);

        for (int i = 0; i < r - 1; i++) {
            Set<Long> set = new HashSet<>();
            for (int j = 0; j < c; j++)
                set.add(matrix[i + 1][j] - matrix[i][j]);
            if (!check(set)) return false;
        }

        for (int j = 0; j < c - 1; j++) {
            Set<Long> set = new HashSet<>();
            for (int i = 0; i < r; i++)
                set.add(matrix[i][j + 1] - matrix[i][j]);
            if (!check(set)) return false;
        }

        if (k == -1) k = max + 1;
        if (k <= max) return false;

        long[] a = new long[r], b = new long[c];
        a[0] = 0;
        b[0] = matrix[0][0];
        for (int i = 1; i < r; i++)
            a[i] = (a[i - 1] + matrix[i][0] - matrix[i - 1][0] + k) % k;
        for (int j = 1; j < c; j++)
            b[j] = (b[j - 1] + matrix[0][j] - matrix[0][j - 1] + k) % k;

        System.out.println("YES");
        System.out.println(k);
        for (int i = 0; i < a.length; i++)
            System.out.print(a[i] + " ");
        System.out.println();
        for (int i = 0; i < b.length; i++)
            System.out.print(b[i] + " ");
        System.out.println();

        return true;
    }

    public static void main(String[] args) throws Exception {
        Reader.init(System.in);
        BufferedWriter cout = new BufferedWriter(new OutputStreamWriter(System.out));

        r = Reader.nextInt();
        c = Reader.nextInt();
        matrix = new long[r][c];
        for (int i = 0; i < r; i++)
            for (int j = 0; j < c; j++)
                matrix[i][j] = Reader.nextInt();
        if (!doit()) System.out.println("NO");

        cout.close();
    }

    static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
        final U _1;
        final V _2;

        private Pair(U key, V val) {
            this._1 = key;
            this._2 = val;
        }

        public static <U extends Comparable<U>, V extends Comparable<V>> Pair<U, V> instanceOf(U _1, V _2) {
            return new Pair<U, V>(_1, _2);
        }

        @Override
        public String toString() {
            return _1 + " " + _2;
        }

        @Override
        public int hashCode() {
            int res = 17;
            res = res * 31 + _1.hashCode();
            res = res * 31 + _2.hashCode();
            return res;
        }

        @Override
        public int compareTo(Pair<U, V> that) {
            int res = this._1.compareTo(that._1);
            if (res < 0 || res > 0) return res;
            else return this._2.compareTo(that._2);
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj) return true;
            if (!(obj instanceof Pair)) return false;
            Pair<?, ?> that = (Pair<?, ?>) obj;
            return _1.equals(that._1) && _2.equals(that._2);
        }
    }

    /** Class for buffered reading int and double values */
    static class Reader {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /** call this method to initialize reader for InputStream */
        static void init(InputStream input) {
            reader = new BufferedReader(new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        /** get next word */
        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                // TODO add check for eof if necessary
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

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

    static class ArrayUtil {
        static void swap(int[] a, int i, int j) {
            int tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void swap(long[] a, int i, int j) {
            long tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void swap(double[] a, int i, int j) {
            double tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void swap(char[] a, int i, int j) {
            char tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void swap(boolean[] a, int i, int j) {
            boolean tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void reverse(int[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static void reverse(long[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static void reverse(double[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static void reverse(char[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static void reverse(boolean[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static long sum(int[] a) {
            int sum = 0;
            for (int i : a)
                sum += i;
            return sum;
        }

        static long sum(long[] a) {
            long sum = 0;
            for (long i : a)
                sum += i;
            return sum;
        }

        static double sum(double[] a) {
            double sum = 0;
            for (double i : a)
                sum += i;
            return sum;
        }

        static int max(int[] a) {
            int max = Integer.MIN_VALUE;
            for (int i : a)
                if (i > max) max = i;
            return max;
        }

        static int min(int[] a) {
            int min = Integer.MAX_VALUE;
            for (int i : a)
                if (i < min) min = i;
            return min;
        }

        static long max(long[] a) {
            long max = Long.MIN_VALUE;
            for (long i : a)
                if (i > max) max = i;
            return max;
        }

        static long min(long[] a) {
            long min = Long.MAX_VALUE;
            for (long i : a)
                if (i < min) min = i;
            return min;
        }
    }
}