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.io.*;
public class FlagofBerland {
    
    
    
    /************************ SOLUTION STARTS HERE ************************/
    static int n , m ;
    static char grid[][];
    static int[] find(char ch) {
        int sx = -1, sy = -1 , ex = -1 , ey = -1;
        o1:
        for(int i = 0; i < n; i++)
            for(int j = 0; j < m; j++) {
                if(grid[i][j] == ch) {
                    sx = i;
                    sy = j;
                    break o1;
                }
            }
        o2:
        for(int i = n - 1; i >= 0; i--)
            for(int j = m - 1; j >= 0; j--) {
                if(grid[i][j] == ch) {
                    ex = i;
                    ey = j;
                    break o2;
                }
            }
            
            if(sx >= 0 && sy >= 0 && ex >= 0 && ey >= 0) {
                // println((char)ch + String.format("start (%d , %d) end (%d , %d)", sx , sy , ex , ey)); 
                boolean flag = true;
                for(int i = sx; i <= ex; i++)
                    for(int j = sy; j <= ey; j++)
                        flag &= grid[i][j] == ch;
                for(int i = 0; i < n; i++)
                    for(int j = 0; j < m; j++)
                        if(!(i >= sx && i <= ex && j >= sy && j <= ey))
                            flag &= grid[i][j] != ch;
                if(flag) 
                    return new int[]{ex - sx , ey - sy};
            }
            
            return null;
    }
    
    private static void solve() {
        
        
        n = nextInt();
        m = nextInt();
        grid = new char[n][];
        for(int i = 0; i < n; i++)
            grid[i] = nextLine().toCharArray();
        
        int R[] = find('R');
        int G[] = find('G');
        int B[] = find('B');
        
        if(R != null && G != null && B != null)
            println(R[0] == G[0] && G[0] == B[0] && R[1] == G[1] && G[1] == B[1] ? "YES" : "NO");
        else
            println("NO");
        
    }
    
    
    
    /************************ SOLUTION ENDS HERE ************************/
    
    
    
    
    
    /************************ TEMPLATE STARTS HERE **********************/
    
    public static void main(String[] args) throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
        st     = null;
        solve();
        reader.close();
        writer.close();
    }
    
    static BufferedReader reader;
    static PrintWriter    writer;
    static StringTokenizer st;
    
    static String next()
    {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}            
    st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
    static String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}             
    static int    nextInt()   {return Integer.parseInt(next());}
    static long   nextLong()  {return Long.parseLong(next());}     
    static double nextDouble(){return Double.parseDouble(next());}
    static char   nextChar()  {return next().charAt(0);}
    static int[]  nextIntArray(int n)         {int[] a= new int[n];   int i=0;while(i<n){a[i++]=nextInt();}  return a;}
    static long[] nextLongArray(int n)        {long[]a= new long[n];  int i=0;while(i<n){a[i++]=nextLong();} return a;}    
    static int[]  nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}            
    static long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}            
    static void   print(Object o)  { writer.print(o);  }
    static void   println(Object o){ writer.println(o);}
    
    /************************ TEMPLATE ENDS HERE ************************/
    
}