Logical quantifiers are very useful tools for expressing claims about a set. For this problem, let's focus on the set of real numbers specifically. The set of real numbers includes zero and negatives. There are two kinds of quantifiers: universal (∀) and existential (∃). You can read more about them here.

The universal quantifier is used to make a claim that a statement holds for all real numbers. For example:

  * ∀ x,x<100 is read as: for all real numbers x, x is less than 100. This statement is false. 
  * ∀ x,x>x-1 is read as: for all real numbers x, x is greater than x-1. This statement is true. 



The existential quantifier is used to make a claim that there exists some real number for which the statement holds. For example:

  * ∃ x,x<100 is read as: there exists a real number x such that x is less than 100. This statement is true. 
  * ∃ x,x>x-1 is read as: there exists a real number x such that x is greater than x-1. This statement is true. 



Moreover, these quantifiers can be nested. For example:

  * ∀ x,∃ y,x<y is read as: for all real numbers x, there exists a real number y such that x is less than y. This statement is true since for every x, there exists y=x+1. 
  * ∃ y,∀ x,x<y is read as: there exists a real number y such that for all real numbers x, x is less than y. This statement is false because it claims that there is a maximum real number: a number y larger than every x. 



Note that the order of variables and quantifiers is important for the meaning and veracity of a statement.

There are n variables x_1,x_2,…,x_n, and you are given some formula of the form $$$ f(x_1,...,x_n):=(x_{j_1}<x_{k_1})∧ (x_{j_2}<x_{k_2})∧ ⋅⋅⋅∧ (x_{j_m}<x_{k_m}), $$$

where ∧ denotes logical AND. That is, f(x_1,…, x_n) is true if every inequality x_{j_i}<x_{k_i} holds. Otherwise, if at least one inequality does not hold, then f(x_1,…,x_n) is false.

Your task is to assign quantifiers Q_1,…,Q_n to either universal (∀) or existential (∃) so that the statement $$$ Q_1 x_1, Q_2 x_2, …, Q_n x_n, f(x_1,…, x_n) $$$

is true, and the number of universal quantifiers is maximized, or determine that the statement is false for every possible assignment of quantifiers.

Note that the order the variables appear in the statement is fixed. For example, if f(x_1,x_2):=(x_1<x_2) then you are not allowed to make x_2 appear first and use the statement ∀ x_2,∃ x_1, x_1<x_2. If you assign Q_1=∃ and Q_2=∀, it will only be interpreted as ∃ x_1,∀ x_2,x_1<x_2.

Input

The first line contains two integers n and m (2≤ n≤ 2⋅ 10^5; 1≤ m≤ 2⋅ 10^5) — the number of variables and the number of inequalities in the formula, respectively.

The next m lines describe the formula. The i-th of these lines contains two integers j_i,k_i (1≤ j_i,k_i≤ n, j_i≠ k_i).

Output

If there is no assignment of quantifiers for which the statement is true, output a single integer -1.

Otherwise, on the first line output an integer, the maximum possible number of universal quantifiers.

On the next line, output a string of length n, where the i-th character is "A" if Q_i should be a universal quantifier (∀), or "E" if Q_i should be an existential quantifier (∃). All letters should be upper-case. If there are multiple solutions where the number of universal quantifiers is maximum, print any.

Examples

Input


2 1
1 2


Output


1
AE


Input


4 3
1 2
2 3
3 1


Output


-1


Input


3 2
1 3
2 3


Output


2
AAE

Note

For the first test, the statement ∀ x_1, ∃ x_2, x_1<x_2 is true. Answers of "EA" and "AA" give false statements. The answer "EE" gives a true statement, but the number of universal quantifiers in this string is less than in our answer.

For the second test, we can show that no assignment of quantifiers, for which the statement is true exists.

For the third test, the statement ∀ x_1, ∀ x_2, ∃ x_3, (x_1<x_3)∧ (x_2<x_3) is true: We can set x_3=max\\{x_1,x_2\}+1.
import java.io.*; import java.util.*;
public class CF1344C {

    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            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 nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        
    } 
    static int MOD=998244353;
    static int[] dp1,dp2;
    static boolean[] vis;
    public static void main(String[] args) {
        FastReader br=new FastReader();
        int N=br.nextInt(); int M=br.nextInt();
        ArrayList<Integer> out[]=new ArrayList[N]; for (int i = 0; i < N; i++) {out[i]=new ArrayList<>();}
        ArrayList<Integer> ing[]=new ArrayList[N]; for (int i = 0; i < N; i++) {ing[i]=new ArrayList<>();}
        int[] in=new int[N];int a,b;
        for (int i = 0; i < M; i++) {
            a=br.nextInt()-1; b=br.nextInt()-1;
            out[a].add(b); in[b]++; ing[b].add(a);
        }
        
        Queue<Integer> qu=new LinkedList<>();
        boolean[] ans=new boolean[N]; int cnt=0;
        for (int i = 0; i < N; i++) {if(in[i]==0){qu.add(i); ans[i]=true; cnt++;}}
        int done=0; 
        while(done<N && !qu.isEmpty()){
            done++;
            a=qu.poll();
            for (int i: out[a]) {
                in[i]--;
                if(in[i]==0){
                    qu.add(i);
                }
            }
        }
        if(done<N){
            System.out.println(-1); return;
        }
        StringBuilder sb=new StringBuilder();
        //The key observation is any x_i that is not comparable to 
        //DFS on indegree graph and outdegree graph separately.
        
        dp1=new int[N]; Arrays.fill(dp1,MOD); vis=new boolean[N];
        int cur=0;
        while(cur<N){
            while(cur<N && vis[cur]){cur++;}
            //BFS!
            if(cur<N){
                vis[cur]=true;
                dfs(out,cur,dp1);
            }
        }
        cur=0; vis=new boolean[N]; dp2=new int[N]; Arrays.fill(dp2,MOD);
        while(cur<N){
            while(cur<N && vis[cur]){cur++;}
            //BFS!
            if(cur<N){
                vis[cur]=true;
                dfs(ing,cur,dp2);
            }
        }
        
        cnt=0;
        for (int i = 0; i < N; i++) {
            if(dp1[i]>=i && dp2[i]>=i){
                sb.append('A'); cnt++; //System.out.println(i+":O");
            }else{
                sb.append('E');
            }
        }
        System.out.println(cnt);
        System.out.println(sb.toString());
    }
    public static void dfs(ArrayList<Integer>[] arl, int cur, int[] dp){
       
        for (int i : arl[cur]) {
            
            if(!vis[i]){
                dp[i]=Math.min(cur,Math.min(dp[cur],dp[i])); dp[cur]=Math.min(i,Math.min(dp[i],dp[cur]));
                vis[i]=true;
                dfs(arl,i,dp);
            }
            
        }
        
    }
}
//Is my algorithm correct? Any counter-cases?
//Bounds: Overflow, 
//Special cases: n=1, ...