#include <bits/stdc++.h>
using namespace std;
int fa[1005];
int n, m;
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void merge(int u, int v) {
  int ru = find(u);
  int rv = find(v);
  if (ru != rv) {
    fa[ru] = rv;
  }
}
int main() {
  int u, v;
  int flag = 0, fail = 0, r = 0;
  cin >> n >> m;
  int temp = m;
  for (int i = 0; i < n; i++) {
    fa[i] = i;
  }
  while (temp--) {
    cin >> u >> v;
    if (fail) continue;
    int ru = find(u);
    int rv = find(v);
    if (ru != rv) {
      r++;
      fa[ru] = rv;
    } else {
      if (!flag) {
        r++;
        flag = 1;
      } else {
        fail = 1;
      }
    }
  }
  if (fail || !flag || n != m) {
    cout << "NO" << endl;
  } else {
    cout << "FHTAGN!" << endl;
  }
  return 0;
}
