#include <bits/stdc++.h>
using namespace std;
int parent[5000], size[5000];
int find_parent(int i) {
  if (parent[i] != i) {
    parent[i] = find_parent(parent[i]);
  }
  return parent[i];
}
int main() {
  int n, m, i, aux1, aux2, res = 0, x, y;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    parent[i] = i;
    size[i] = 1;
  }
  for (i = 0; i < m; i++) {
    cin >> aux1 >> aux2;
    x = find_parent(aux1 - 1);
    y = find_parent(aux2 - 1);
    if (x != y) {
      if (size[x] >= size[y]) {
        size[x] += size[y];
        parent[y] = x;
      } else {
        size[y] += size[x];
        parent[x] = y;
      }
    }
  }
  for (i = 0; i < n; i++) {
    res += (parent[i] == i);
  }
  if (res == 1 && n == m) {
    cout << "FHTAGN!" << endl;
  } else {
    cout << "NO" << endl;
  }
}
