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 B implements Runnable{
	public static void main (String[] args) {new Thread(null, new B(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt(), m = fs.nextInt();
		char[][] g = new char[n][m];
		for(int i = 0; i < n; i++) {
			g[i] = fs.next().toCharArray();
		}
		int[] lowX = new int[3];
		int[] hiX = new int[3];
		int[] lowY = new int[3];
		int[] hiY = new int[3];
		Arrays.fill(lowX, n);
		Arrays.fill(hiX, -1);
		Arrays.fill(lowY, m);
		Arrays.fill(hiY, -1);
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				int idx = map(g[i][j]);
				lowX[idx] = Math.min(lowX[idx], i);
				hiX[idx] = Math.max(hiX[idx], i);
				lowY[idx] = Math.min(lowY[idx], j);
				hiY[idx] = Math.max(hiY[idx], j);
			}
		}
		
		
		for(int i = 0; i < 3; i++) {
			if(hiX[i] < 0 || hiY[i] < 0) {
				System.out.println("NO");
				return;
			}
		}
		
		for(int i = 0; i < 3; i++) {
			int height = hiX[i] - lowX[i];
			int width = hiY[i] - lowY[i];
			if(height != hiX[0] - lowX[0] || width != hiY[0] - lowY[0]) {
				System.out.println("NO");
				return;
			}
		}
		
		char[][] test = build(lowX, hiX, lowY, hiY, n, m);
		for(int i = 0; i < n; i++) {
			String one = new String(test[i]);
			String two = new String(g[i]);
			if(!one.equals(two)) {
				System.out.println("NO");
				return;			}
		}
		System.out.println("YES");
		
		out.close();
	}
	
	
	private char[][] build(int[] lowX, int[] hiX, int[] lowY, int[] hiY, int n, int m) {
		char[][] res = new char[n][m];
		for(int i = 0; i < 3; i++) {
			for(int ii = lowX[i]; ii <= hiX[i]; ii++) {
				for(int jj = lowY[i]; jj <= hiY[i]; jj++) {
					res[ii][jj] = rap(i);
				}
			}
		}
		return res;
	}

	char rap(int a) {
		if(a == 0) return 'B';
		if(a == 1) return 'G';
		return 'R';
	}
	
	int map(char c) {
		if(c == 'B') return 0;
		if(c == 'G') return 1;
		return 2;
	}

	void sort (int[] a) {
		int n = a.length;
		for(int i = 0; i < 50; i++) {
			Random r = new Random();
			int x = r.nextInt(n), y = r.nextInt(n);
			int temp = a[x];
			a[x] = a[y];
			a[y] = temp;
		}
		Arrays.sort(a);
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}