#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int cnt;
void DFS(int cur, vector<int>* adj, vector<bool>& seen) {
  seen[cur] = true;
  cnt++;
  for (int u : adj[cur]) {
    if (!seen[u]) DFS(u, adj, seen);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  while (cin >> n >> m) {
    if (n == 0 && m == 0) break;
    vector<int> adj[n];
    for (int i = 0; i < m; ++i) {
      int a, b;
      cin >> a >> b;
      a--, b--;
      adj[a].emplace_back(b);
      adj[b].emplace_back(a);
    }
    if (n != m) {
      printf("NO\n");
      continue;
    }
    cnt = 0;
    vector<bool> seen(n, false);
    DFS(0, adj, seen);
    printf("%s\n", cnt == n ? "FHTAGN!" : "NO");
  }
  return 0;
}
