import java.util.*;
class Main{
	public static void main(String[] argv){
		//rated();
		accepted();
	}
	static void rated(){
		Scanner sc = new Scanner(System.in);
		int rate = sc.nextInt();
		if (rate<1200){
			System.out.println("ABC");
		}else{
			if(rate<2800){
				System.out.println("ARC");
			}else{
				System.out.println("AGC");
			}
		}
	}
	static void accepted(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "AC";
		/*
		*先頭がA
		*先頭から三文字目から後ろから二文字目の間にCをちょうどひとつ含む．
		*A，C以外は小文字
		*/
		if(s.charAt(0)!='A'){
			ans = "WA";
		}
		if(Character.isUpperCase(s.charAt(1))){
			ans = "WA";
		}
		
		boolean hasC = false;
		for(int i=2;i<s.length()-1;i++){
			if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			}
		}
		if(Character.isUpperCase(s.charAt(s.length()-1))||hasC==false){
			ans = "WA";
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] argv){
		//rated();
		accepted();
	}
	static void rated(){
		Scanner sc = new Scanner(System.in);
		int rate = sc.nextInt();
		if (rate<1200){
			System.out.println("ABC");
		}else{
			if(rate<2800){
				System.out.println("ARC");
			}else{
				System.out.println("AGC");
			}
		}
	}
	static void accepted(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "AC";
		/*
		*先頭がA
		*先頭から三文字目から後ろから二文字目の間にCをちょうどひとつ含む．
		*A，C以外は小文字
		*/
		if(s.charAt(0)!='A'){
			ans = "WA";
		}
		if(Character.isUpperCase(s.charAt(1))){
			ans = "WA";
		}
		
		boolean hasC = false;
		for(int i=2;i<s.length()-1;i++){
			if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			}
		}
		if(Character.isUpperCase(s.charAt(s.length()-1))||hasC==false){
			ans = "WA";
		}
		System.out.println(ans);
	}
} Main public static void main(String[] argv){
		//rated();
		accepted();
	} main {
		//rated();
		accepted();
	} accepted() accepted String[] argv argv static void rated(){
		Scanner sc = new Scanner(System.in);
		int rate = sc.nextInt();
		if (rate<1200){
			System.out.println("ABC");
		}else{
			if(rate<2800){
				System.out.println("ARC");
			}else{
				System.out.println("AGC");
			}
		}
	} rated {
		Scanner sc = new Scanner(System.in);
		int rate = sc.nextInt();
		if (rate<1200){
			System.out.println("ABC");
		}else{
			if(rate<2800){
				System.out.println("ARC");
			}else{
				System.out.println("AGC");
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int rate = sc.nextInt(); rate sc.nextInt() sc.nextInt sc if (rate<1200){
			System.out.println("ABC");
		}else{
			if(rate<2800){
				System.out.println("ARC");
			}else{
				System.out.println("AGC");
			}
		} rate<1200 rate 1200 {
			System.out.println("ABC");
		} System.out.println("ABC") System.out.println System.out System System.out "ABC" {
			if(rate<2800){
				System.out.println("ARC");
			}else{
				System.out.println("AGC");
			}
		} if(rate<2800){
				System.out.println("ARC");
			}else{
				System.out.println("AGC");
			} rate<2800 rate 2800 {
				System.out.println("ARC");
			} System.out.println("ARC") System.out.println System.out System System.out "ARC" {
				System.out.println("AGC");
			} System.out.println("AGC") System.out.println System.out System System.out "AGC" static void accepted(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "AC";
		/*
		*先頭がA
		*先頭から三文字目から後ろから二文字目の間にCをちょうどひとつ含む．
		*A，C以外は小文字
		*/
		if(s.charAt(0)!='A'){
			ans = "WA";
		}
		if(Character.isUpperCase(s.charAt(1))){
			ans = "WA";
		}
		
		boolean hasC = false;
		for(int i=2;i<s.length()-1;i++){
			if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			}
		}
		if(Character.isUpperCase(s.charAt(s.length()-1))||hasC==false){
			ans = "WA";
		}
		System.out.println(ans);
	} accepted {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "AC";
		/*
		*先頭がA
		*先頭から三文字目から後ろから二文字目の間にCをちょうどひとつ含む．
		*A，C以外は小文字
		*/
		if(s.charAt(0)!='A'){
			ans = "WA";
		}
		if(Character.isUpperCase(s.charAt(1))){
			ans = "WA";
		}
		
		boolean hasC = false;
		for(int i=2;i<s.length()-1;i++){
			if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			}
		}
		if(Character.isUpperCase(s.charAt(s.length()-1))||hasC==false){
			ans = "WA";
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String ans = "AC"; ans "AC" if(s.charAt(0)!='A'){
			ans = "WA";
		} s.charAt(0)!='A' s.charAt(0) s.charAt s 0 'A' {
			ans = "WA";
		} ans = "WA" ans "WA" if(Character.isUpperCase(s.charAt(1))){
			ans = "WA";
		} Character.isUpperCase(s.charAt(1)) Character.isUpperCase Character s.charAt(1) s.charAt s 1 {
			ans = "WA";
		} ans = "WA" ans "WA" boolean hasC = false; hasC false for(int i=2;i<s.length()-1;i++){
			if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			}
		} int i=2; int i=2; i 2 i<s.length()-1 i s.length()-1 s.length() s.length s 1 i++ i++ i {
			if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			}
		} {
			if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			}
		} if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			} Character.isUpperCase(s.charAt(i)) Character.isUpperCase Character s.charAt(i) s.charAt s i {
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			} if(hasC){
					ans = "WA";
				} hasC {
					ans = "WA";
				} ans = "WA" ans "WA" if(s.charAt(i)=='C'){
					hasC = true;
				} s.charAt(i)=='C' s.charAt(i) s.charAt s i 'C' {
					hasC = true;
				} hasC = true hasC true if(Character.isUpperCase(s.charAt(s.length()-1))||hasC==false){
			ans = "WA";
		} Character.isUpperCase(s.charAt(s.length()-1))||hasC==false Character.isUpperCase(s.charAt(s.length()-1)) Character.isUpperCase Character s.charAt(s.length()-1) s.charAt s s.length()-1 s.length() s.length s 1 hasC==false hasC false {
			ans = "WA";
		} ans = "WA" ans "WA" System.out.println(ans) System.out.println System.out System System.out ans
import java.util.*;
class Main{
	public static void main(String[] argv){
		//rated();
		accepted();
	}
	static void rated(){
		Scanner sc = new Scanner(System.in);
		int rate = sc.nextInt();
		if (rate<1200){
			System.out.println("ABC");
		}else{
			if(rate<2800){
				System.out.println("ARC");
			}else{
				System.out.println("AGC");
			}
		}
	}
	static void accepted(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "AC";
		/*
		*先頭がA
		*先頭から三文字目から後ろから二文字目の間にCをちょうどひとつ含む．
		*A，C以外は小文字
		*/
		if(s.charAt(0)!='A'){
			ans = "WA";
		}
		if(Character.isUpperCase(s.charAt(1))){
			ans = "WA";
		}
		
		boolean hasC = false;
		for(int i=2;i<s.length()-1;i++){
			if(Character.isUpperCase(s.charAt(i))){
				if(hasC){
					ans = "WA";
				}
				if(s.charAt(i)=='C'){
					hasC = true;
				}
			}
		}
		if(Character.isUpperCase(s.charAt(s.length()-1))||hasC==false){
			ans = "WA";
		}
		System.out.println(ans);
	}
}