The flag of Berland is such rectangular field n × m that satisfies following conditions:

  * Flag consists of three colors which correspond to letters 'R', 'G' and 'B'. 
  * Flag consists of three equal in width and height stripes, parralel to each other and to sides of the flag. Each stripe has exactly one color. 
  * Each color should be used in exactly one stripe. 



You are given a field n × m, consisting of characters 'R', 'G' and 'B'. Output "YES" (without quotes) if this field corresponds to correct flag of Berland. Otherwise, print "NO" (without quotes).

Input

The first line contains two integer numbers n and m (1 ≤ n, m ≤ 100) — the sizes of the field.

Each of the following n lines consisting of m characters 'R', 'G' and 'B' — the description of the field.

Output

Print "YES" (without quotes) if the given field corresponds to correct flag of Berland . Otherwise, print "NO" (without quotes).

Examples

Input

6 5
RRRRR
RRRRR
BBBBB
BBBBB
GGGGG
GGGGG


Output

YES


Input

4 3
BRG
BRG
BRG
BRG


Output

YES


Input

6 7
RRRGGGG
RRRGGGG
RRRGGGG
RRRBBBB
RRRBBBB
RRRBBBB


Output

NO


Input

4 4
RRRR
RRRR
BBBB
GGGG


Output

NO

Note

The field in the third example doesn't have three parralel stripes.

Rows of the field in the fourth example are parralel to each other and to borders. But they have different heights — 2, 1 and 1.
import java.io.*;
import java.util.*;

public class Main {

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

        new Main().solve();
    }

    int inf = 2000000000;
    int mod = 1000000007;
    double eps = 0.000000001;

    PrintWriter out;

    //int n;
    int m;
    int k;

    //ArrayList<Integer>[] g = new ArrayList[110];

    int maxn = 0;
    int[][] g;

    void solve() throws IOException {

        Reader in;
        BufferedReader br;

        try {

            //br = new BufferedReader( new FileReader("input.txt") );
            in = new Reader("input.txt111");
            out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        }
        catch (Exception e) {

            //br = new BufferedReader( new InputStreamReader( System.in ) );
            in = new Reader();
            out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        }

        int n = in.nextInt();
        int m = in.nextInt();

        char[][] a = new char[n][m];

        for (int i = 0; i < n; i++) {
            String s = in.nextLine();
            for (int j = 0; j < m; j++)
                a[i][j] = s.charAt(j);
        }

        String rgb = "RGB";

        if (n%3 == 0) {

            int[] cnt = new int[3];
            boolean ok = true;
            int x = n/3;

            for (int k = 0; k < 3; k++) {
                for (int i = k * x; i < k * x + x; i++)
                    for (int j = 0; j < m; j++) {
                        int type = rgb.indexOf(a[i][j]);
                        cnt[type]++;
                    }


                int sum = (k+1)*(m*n/3);
                ok &= cnt[0]+cnt[1]+cnt[2] == sum;
                for (int i = 0; i < 3; i++)
                    ok &= cnt[i] == (m*n/3) || cnt[i] == 0;
            }

            if (ok) {
                System.out.println("YES");
                return;
            }
        }

        if (m%3 == 0) {

            int[] cnt = new int[3];
            boolean ok = true;
            int x = m/3;

            for (int k = 0; k < 3; k++) {
                for (int i = 0; i < n; i++)
                    for (int j = k*x; j < k*x+x; j++) {
                        int type = rgb.indexOf(a[i][j]);
                        cnt[type]++;
                    }


                int sum = (k+1)*(n*m/3);
                ok &= cnt[0]+cnt[1]+cnt[2] == sum;
                for (int i = 0; i < 3; i++)
                    ok &= cnt[i] == (n*m/3) || cnt[i] == 0;
            }

            if (ok) {
                System.out.println("YES");
                return;
            }
        }

        out.println("No");

        out.flush();
        out.close();
    }

    class Pair implements Comparable<Pair>{

        int a;
        int b;

        Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {
            if (a > p.a) return -1;
            if (a < p.a) return 1;
            return 0;
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }


        String nextLine() throws IOException {
            return br.readLine();
        }

    }

}