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.
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int MOD = 1000000007;
const int INF = 2000000000;
const long long DESPACITO = 1000000000000000000;
namespace minmax {
template <class T>
T max(T&& A) {
  return A;
}
template <class T>
T min(T&& A) {
  return A;
}
template <class T>
T max(T&& A, T&& B) {
  return A > B ? A : B;
}
template <class T>
T chmin2(T&& A, T&& B) {
  return A < B ? A : B;
}
template <class T, class... Ts>
T max(T&& A, Ts&&... ts) {
  T B = max(ts...);
  return A > B ? A : B;
}
template <class T, class... Ts>
T min(T&& A, Ts&&... ts) {
  T B = min(ts...);
  return A < B ? A : B;
}
template <class T, class... Ts>
T chmax(T&& A, Ts&&... ts) {
  A = max(A, ts...);
  return A;
}
template <class T, class... Ts>
T chmin(T&& A, Ts&&... ts) {
  A = min(A, ts...);
  return A;
}
template <class T1, class T2>
void chmin2(T1&& A, T2&& Aa, T1&& B, T2&& Bb) {
  if (B < A) A = B, Aa = Bb;
}
template <class T1, class T2>
void chmax2(T1&& A, T2&& Aa, T1&& B, T2&& Bb) {
  if (B > A) A = B, Aa = Bb;
}
}  // namespace minmax
namespace input {
template <class T>
void re(T&& Xx) {
  cin >> Xx;
}
template <class T1, class T2>
void re(pair<T1, T2>& Pp) {
  re(Pp.first);
  re(Pp.second);
}
template <class T>
void re(vector<T>& Aa) {
  for (int i = 0; i < (int)(Aa).size(); i++) re(Aa[i]);
}
template <class T1, class T2>
void rea(T1&& Aa, T2 t) {
  for (int i = 0; i < t; i++) re(Aa[i]);
}
template <class T1, class T2, class... Ts>
void rea(T1&& Aa, T2 t, Ts&&... ts) {
  rea(Aa, t);
  rea(ts...);
}
template <class T1, class T2>
void rea1(T1&& Aa, T2 t) {
  for (int i = 1; i <= t; i++) re(Aa[i]);
}
template <class T1, class T2, class... Ts>
void rea1(T1&& Aa, T2 t, Ts&... ts) {
  rea1(Aa, t);
  rea1(ts...);
}
template <class T, class... Ts>
void re(T&& t, Ts&... ts) {
  re(t);
  re(ts...);
}
}  // namespace input
namespace output {
void pr(int32_t Xx) { cout << Xx; }
void pr(bool Xx) { cout << Xx; }
void pr(long long Xx) { cout << Xx; }
void pr(long long unsigned Xx) { cout << Xx; }
void pr(double Xx) { cout << Xx; }
void pr(char Xx) { cout << Xx; }
void pr(const string& Xx) { cout << Xx; }
void pr(const char* Xx) { cout << Xx; }
void pr(const char* Xx, size_t len) { cout << string(Xx, len); }
void ps() { cout << "\n"; }
void pn() {}
void pw() { pr(" "); }
void pc() {
  pr("]");
  ps();
}
template <class T1, class T2>
void pr(const pair<T1, T2>& Xx) {
  pr(Xx.first);
  pw();
  pr(Xx.second);
}
template <class T>
void pr(const T&);
bool parse(const char* t) {
  if (t == "\n") return true;
  return false;
}
template <class T>
bool parse(T&& t) {
  return false;
}
template <class T1, class T2>
bool parsepair(const pair<T1, T2>& Xx) {
  return true;
}
template <class T>
bool parsepair(T&& t) {
  return false;
}
template <class T1, class T2>
void psa(T1&& Aa, T2 t) {
  for (int i = 0; i < t; i++) pr(Aa[i]), pw();
  ps();
}
template <class T1, class T2>
void pna(T1&& Aa, T2 t) {
  for (int i = 0; i < t; i++) pr(Aa[i]), ps();
}
template <class T1, class T2>
void psa2(T1&& Aa, T2 t1, T2 t2) {
  for (int i = 0; i < t1; i++) {
    for (int j = 0; j < t2; j++) pr(Aa[i][j]), pw();
    ps();
  }
}
template <class T>
void pr(const T& Xx) {
  if (!(int)(Xx).size()) return;
  bool fst = 1;
  bool op = 0;
  if (parsepair(*Xx.begin())) op = 1;
  for (const auto& Aa : Xx) {
    if (!fst) pw();
    if (op) pr("{");
    pr(Aa), fst = 0;
    if (op) pr("}");
  }
}
template <class T, class... Ts>
void pr(const T& t, const Ts&... ts) {
  pr(t);
  pr(ts...);
}
template <class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) {
    if (!parse(t)) pw();
  }
  ps(ts...);
}
template <class T>
void pn(const T& t) {
  for (const auto& Aa : t) ps(Aa);
}
template <class T, class... Ts>
void pw(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pw();
  pw(ts...);
}
template <class T, class... Ts>
void pc(const T& t, const Ts&... ts) {
  bool op = 0;
  if (parsepair(t)) op = 1;
  if (op) pr("{");
  pr(t);
  if (op) pr("}");
  if (sizeof...(ts)) pr(", ");
  pc(ts...);
}
namespace trace {
template <class T1, class T2>
void __f(const char* name, const T1& Xx, const T2& y) {
  pr("[", y, "] = ");
  ps(Xx);
}
template <class T1, class T2, class... Ts>
void __f(const char* name, const T1& Xx, const T2& y, const Ts&... rest) {
  const char* open = strchr(name, '[');
  pr("[", y, "]");
  __f(open + 1, Xx, rest...);
}
template <class T1, class T2, class... Ts>
void __f0(const char* name, const T1& Xx, const T2& y, const Ts&... rest) {
  const char* open = strchr(name, '[');
  pr(name, size_t(open - name));
  __f(name, Xx, y, rest...);
}
template <class T>
void __fn(int n, const char* name, const T& Xx) {
  for (int i = 0; i < n; i++) pr(name), __f(name, Xx[i], i);
}
}  // namespace trace
}  // namespace output
using namespace minmax;
using namespace input;
using namespace output;
using namespace output::trace;
const int N = 2e5 + 5;
int n, m, in[N];
vector<int> succ[N], pred[N];
void makeG() {
  for (int i = 0; i < m; i++) {
    int u, v;
    re(u, v);
    u--, v--;
    in[v]++;
    succ[u].emplace_back(v);
    pred[v].emplace_back(u);
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int i, cnt = 0;
  re(n, m);
  makeG();
  vector<int> topsort;
  topsort.reserve(n);
  for (i = 0; i < n; i++)
    if (!in[i]) topsort.emplace_back(i);
  for (i = 0; i < (int)(topsort).size(); i++) {
    int cur = topsort[i];
    for (auto& nxt : succ[cur])
      if (!--in[nxt]) topsort.emplace_back(nxt);
  }
  if ((int)(topsort).size() < n) return ps(-1), 0;
  vector<int> mnsucc(n), mnpred(n);
  iota(mnsucc.begin(), mnsucc.end(), 0);
  iota(mnpred.begin(), mnpred.end(), 0);
  for (auto& cur : topsort)
    for (auto& prv : pred[cur]) chmin(mnpred[cur], mnpred[prv]);
  for (i = n - 1; ~i; i--) {
    int cur = topsort[i];
    for (auto& nxt : succ[cur]) chmin(mnsucc[cur], mnsucc[nxt]);
  }
  string ans(n, 'E');
  for (i = 0; i < n; i++)
    if (mnpred[i] == i and mnsucc[i] == i) cnt++, ans[i] = 'A';
  ps(cnt, "\n", ans);
  return 0;
}
