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.util.*;
import java.math.*;
import java.io.*;
import java.text.*;

public class A{
    static class Node implements Comparable<Node> {
        int s;
        int q;
        public Node(int s,int q) {
            this.s=s;
            this.q=q;
        }
        public int compareTo(Node c) {
            return this.s-c.s;
        }
    }
    //public static PrintWriter pw;
    public static PrintWriter pw=new PrintWriter(System.out);
    public static void solve() throws IOException {
//	pw=new PrintWriter(new FileWriter("C:\\Users\\shree\\Downloads\\small_output_in"));
        FastReader sc = new FastReader();
        int n = sc.I();
        int m=sc.I();
        char s[][]=new char[n][m];
        for(int i=0;i<n;i++){
            s[i]=sc.next().toCharArray();

        }
        int l[]=new int[3];
        int r[]=new int[3];
        int t[]=new int[3];
        int b[]=new int[3];
        Arrays.fill(l,m);
        Arrays.fill(t,n);
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                int ii=get(s[i][j]);
                l[ii]=Math.min(l[ii],j);
                r[ii]=Math.max(r[ii],j);
                t[ii]=Math.min(t[ii],i);
                b[ii]=Math.max(b[ii],i);
            }
        }
        int l0=b[0]-t[0];
        int b0=r[0]-l[0];
        int l1=b[1]-t[1];
        int b1=r[1]-l[1];
        int l2=b[2]-t[2];
        int b2=r[2]-l[2];
        if(l0<0 || b0<0 || l1<0 || b1<0 || l2<0 || b2<0) pw.println("NO");
        else {
            if(l0!=l1 || l0!=l2 || l1!=l2 || b0!=b1 || b0!=b2 || b1!=b2) pw.println("NO");
            else {
                boolean ans=true;
                for(int i=0;i<3;i++) if(!check(t[i],b[i],l[i],r[i],s)) ans=false;
                if(ans) pw.println("YES");
                else pw.println("NO");
            }
        }
        pw.close();
    }
    static boolean check(int i1,int i2,int j1,int j2,char s[][]){
        char ch=s[i1][j1];
        for(int i=i1;i<=i2;i++){
            for(int j=j1;j<=j2;j++){
                if(ch!=s[i][j]) return false;
            }
        }
        return true;
    }
    static int get(char ch){
        if(ch=='R') return 0;
        else if(ch=='B') return 1;
        return 2;
    }
    public static void main(String[] args)  {
        new Thread(null ,new Runnable(){
            public void run(){
                try{

                    solve();
                } catch(Exception e){
                    e.printStackTrace();
                }
            }
        },"1",1<<26).start();

    }
    static BufferedReader br;
    static long M=(long)1e9+7;

    static class FastReader {

        StringTokenizer st;

        public FastReader() throws FileNotFoundException{
            //br=new BufferedReader(new FileReader("C:\\Users\\shree\\Downloads\\B-small-practice.in"));
            br = new BufferedReader(new InputStreamReader(System.in));

        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int I(){   return Integer.parseInt(next()); }
        long L(){  return Long.parseLong(next()); }
        double D() {  return Double.parseDouble(next()); }
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public boolean hasNext() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return false;
                }
                st = new StringTokenizer(s);
            }
            return true;
        }

    }
}