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 CFEdu26B {
	public static void main(String args[]) {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		/*------------------------------My Code starts here------------------------------*/
		int n=in.nextInt(),m=in.nextInt(),i,j;
		char[][] a=new char[n][m];
		String s;
		boolean b=false;
		for(i=0;i<n;i++)
		{
			s=in.next();
			for(j=0;j<m;j++)
				a[i][j]=s.charAt(j);
		}
		if(n%3==0)
		{
			Set<Character> st1=new HashSet<>();
			Set<Character> st2=new HashSet<>();
			Set<Character> st3=new HashSet<>();
			for(i=0;i<n/3;i++)
			{
				for(j=0;j<m;j++)
					st1.add(a[i][j]);
			}
			for(;i<2*(n/3);i++)
			{
				for(j=0;j<m;j++)
					st2.add(a[i][j]);
			}
			for(;i<n;i++)
			{
				for(j=0;j<m;j++)
					st3.add(a[i][j]);
			}
			if(st1.size()==1 && st2.size()==1 && st3.size()==1 )
			{
				if((st1.contains('R') && st2.contains('B') && st3.contains('G')) || (st1.contains('R') && st2.contains('G') && st3.contains('B')) || (st1.contains('B') && st2.contains('R') && st3.contains('G')) || (st1.contains('B') && st2.contains('G') && st3.contains('R')) || (st1.contains('G') && st2.contains('B') && st3.contains('R')) || (st1.contains('G') && st2.contains('R') && st3.contains('B')))
					b=true;
			}
		}
		if(m%3==0)
		{
			Set<Character> st1=new HashSet<>();
			Set<Character> st2=new HashSet<>();
			Set<Character> st3=new HashSet<>();
			for(j=0;j<m/3;j++)
			{
				for(i=0;i<n;i++)
					st1.add(a[i][j]);
			}
			for(;j<2*(m/3);j++)
			{
				for(i=0;i<n;i++)
					st2.add(a[i][j]);
			}
			for(;j<m;j++)
			{
				for(i=0;i<n;i++)
					st3.add(a[i][j]);
			}
			if(st1.size()==1 && st2.size()==1 && st3.size()==1 )
			{
				if((st1.contains('R') && st2.contains('B') && st3.contains('G')) || (st1.contains('R') && st2.contains('G') && st3.contains('B')) || (st1.contains('B') && st2.contains('R') && st3.contains('G')) || (st1.contains('B') && st2.contains('G') && st3.contains('R')) || (st1.contains('G') && st2.contains('B') && st3.contains('R')) || (st1.contains('G') && st2.contains('R') && st3.contains('B')))
					b=true;
			}
		}
		out.println((b)?("YES"):("NO"));
		out.close();
		/*------------------------------The End------------------------------------------*/
	}

	public static final long l = (int) (1e9 + 7);

	private static int[] nextIntArray(InputReader in, int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = in.nextInt();
		return a;
	}

	private static long[] nextLongArray(InputReader in, int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = in.nextLong();
		return a;
	}

	private static int[][] nextIntMatrix(InputReader in, int n, int m) {
		int[][] a = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++)
				a[i][j] = in.nextInt();
		}
		return a;
	}

	private static void show(int[] a) {
		for (int i = 0; i < a.length; i++)
			System.out.print(a[i] + " ");
		System.out.println();
	}

	private static void show2DArray(char[][] a) {
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[0].length; j++)
				System.out.print(a[i][j]);
			System.out.println();
		}
	}

	static class Pair {
		private int first;
		private int second;

		public Pair(int i, int j) {
			this.first = i;
			this.second = j;
		}

		public int getFirst() {
			return first;
		}

		public int getSecond() {
			return second;
		}

		public void setFirst(int k) {
			this.first = k;
		}

		public void setSecond(int k) {
			this.second = k;
		}
	}

	static int modPow(int a, int b, int p) {
		int result = 1;
		a %= p;
		while (b > 0) {
			if ((b & 1) != 0)
				result = (result * a) % p;
			b = b >> 1;
			a = (a * a) % p;
		}
		return result;
	}

	public static void SieveOfEratosthenes(int n) {
		boolean[] prime = new boolean[n + 1];
		Arrays.fill(prime, true);
		prime[1] = false;
		int i, j;
		for (i = 2; i * i <= n; i++) {
			if (prime[i]) {
				for (j = i; j <= n; j += i) {
					if (j != i)
						prime[j] = false;
				}
			}
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}

}
