#include <bits/stdc++.h>
using namespace std;
const int MX = (1 << 20);
class Disjoint_Set {
 public:
  int sz[MX], P[MX];
  int find_(int x) {
    if (x != P[x]) P[x] = find_(P[x]);
    return P[x];
  }
  int comp;
  void init(int N) {
    for (int j = 1; j <= N; j++) sz[j] = 1, P[j] = j;
    comp = N;
  }
  bool same(int x, int y) { return find_(x) == find_(y); }
  int compsize(int node) { return sz[find_(node)]; }
  bool merge_(int x, int y) {
    int px = find_(x), py = find_(y);
    if (px == py) return false;
    if (sz[px] < sz[py]) swap(px, py);
    P[py] = px;
    comp--;
    sz[px] += sz[py];
    return true;
  }
} G;
int n, m;
int main() {
  scanf("%d %d", &n, &m);
  if (n != m) {
    puts("NO");
    return 0;
  }
  G.init(n);
  int tt = 0;
  while (m--) {
    int a, b;
    scanf("%d %d", &a, &b);
    if (!G.merge_(a, b)) tt++;
  }
  if (tt == 1)
    puts("FHTAGN!");
  else
    puts("NO");
}
