#include <bits/stdc++.h>
using namespace std;
void print(vector<long long> &a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << " \n"[i == a.size() - 1];
}
void print(vector<int> &a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << " \n"[i == a.size() - 1];
}
void print(vector<char> &a) {
  for (int i = 0; i < a.size(); i++) cout << a[i];
  cout << "\n";
}
void print(int a[], int l, int r) {
  for (int i = l; i <= r; i++) cout << a[i] << " \n"[i == r];
}
void print(long long a[], int l, int r) {
  for (int i = l; i <= r; i++) cout << a[i] << " \n"[i == r];
}
long long qpow(long long x, long long y) {
  long long temp = x;
  long long ans = 1;
  while (y) {
    if (y & 1) ans = (ans * temp);
    temp = (temp * temp);
    y >>= 1;
  }
  return ans;
}
long long qpow(long long x, long long y, long long MOD) {
  long long temp = x;
  long long ans = 1;
  while (y) {
    if (y & 1) ans = (ans * temp) % MOD;
    temp = (temp * temp) % MOD;
    y >>= 1;
  }
  return ans;
}
vector<int> a[400050];
vector<int> b[400050];
int degree[400050];
int father[400050];
int vis[400050];
int father_down[400050];
int vis_down[400050];
bool ok = true;
void dfs(int x) {
  if (vis[x]) return;
  vis[x] = 1;
  if (!ok) return;
  for (auto i : a[x]) {
    if (vis[i] == 1) {
      ok = false;
      return;
    }
    if (!vis[i]) dfs(i);
  }
  vis[x] = 2;
}
void dfs_down(int x) {
  if (vis_down[x]) return;
  vis_down[x] = 1;
  if (!ok) return;
  for (auto i : b[x]) {
    if (vis_down[i] == 1) {
      ok = false;
      return;
    }
    if (vis_down[i] == 0) dfs_down(i);
  }
  vis_down[x] = 2;
}
void solve() {
  memset(degree, 0, sizeof(degree));
  ;
  memset(vis, 0, sizeof(vis));
  ;
  memset(vis_down, 0, sizeof(vis_down));
  ;
  int n, m;
  cin >> n >> m;
  int x, y;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    a[x].push_back(y);
    b[y].push_back(x);
  }
  int ans = 0;
  string s;
  ok = true;
  vector<char> V;
  for (int i = 1; i <= n; i++) {
    if (!ok) break;
    if (!vis[i] && !vis_down[i]) {
      V.push_back('A');
      ans++;
    } else
      V.push_back('E');
    if (!vis[i]) dfs(i);
    if (!vis_down[i]) dfs_down(i);
  }
  if (!ok) {
    cout << "-1"
         << "\n";
    return;
  }
  cout << ans << "\n";
  print(V);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
