#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b;
  cin >> n >> m;
  if (m == n) {
    vector<bool> rev(n, false);
    vector<vector<int> > mat(n + 1);
    for (int i = 0; i < m; i++) {
      cin >> a >> b;
      mat[a].push_back(b);
      mat[b].push_back(a);
    }
    int cont = 0;
    for (int i = 1; i <= m; i++) {
      if (!rev[i]) {
        cont++;
        queue<int> COLA;
        COLA.push(i);
        rev[i] = true;
        while (!COLA.empty()) {
          int j = COLA.front();
          COLA.pop();
          for (int k = 0; k < mat[j].size(); k++) {
            if (!rev[mat[j][k]]) {
              rev[mat[j][k]] = 1;
              COLA.push(mat[j][k]);
            }
          }
        }
      }
    }
    if (cont == 1)
      cout << "FHTAGN!\n";
    else
      cout << "NO\n";
  } else
    cout << "NO\n";
  return 0;
}
