#include <bits/stdc++.h>
using namespace std;
int find(int parent[], int x) {
  int c;
  if (parent[x] == x) return x;
  c = find(parent, parent[x]);
  return c;
}
void set_union(int parent[], int rank[], int x, int y) {
  int xp = find(parent, x);
  int yp = find(parent, y);
  if (xp == yp)
    return;
  else if (rank[xp] > rank[yp])
    parent[yp] = xp;
  else if (rank[yp] > rank[xp])
    parent[xp] = yp;
  else {
    parent[xp] = yp;
    rank[yp]++;
  }
}
int main() {
  int n, m, i, j, x, y, flag;
  cin >> n >> m;
  if (n != m)
    cout << "NO" << endl;
  else {
    int parent[n + 1];
    int rank[n + 1];
    for (i = 1; i <= n; i++) {
      parent[i] = i;
      rank[i] = 1;
    }
    while (m--) {
      cin >> x >> y;
      set_union(parent, rank, x, y);
    }
    int ans = find(parent, 1);
    flag = 0;
    for (i = 2; i <= n; i++) {
      if (find(parent, i) != ans) {
        flag = 1;
        break;
      }
    }
    if (flag)
      cout << "NO";
    else
      cout << "FHTAGN!";
  }
  return 0;
}
