#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> uf;
void init_uf() { fill(uf.begin(), uf.end(), -1); }
int find(int x) {
  if (uf[x] < 0) {
    return x;
  }
  return uf[x] = find(uf[x]);
}
void join(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) {
    return;
  }
  if (uf[x] > uf[y]) {
    swap(x, y);
  }
  uf[x] += uf[y];
  uf[y] = x;
}
int main() {
  cin >> n >> m;
  if (n != m) {
    cout << "NO"
         << "\n";
    return 0;
  }
  uf.resize(n + 1);
  init_uf();
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    join(a, b);
  }
  for (int i = 1; i <= n; i++) {
    int a = find(1);
    if (a != find(i)) {
      cout << "NO"
           << "\n";
      return 0;
    }
  }
  cout << "FHTAGN!"
       << "\n";
  return 0;
}
