#include <bits/stdc++.h>
using namespace std;
struct node {
  int s, t;
} e[11000];
int a[110][110], m, n, cnt;
int p[110];
int find(int x) {
  if (x == p[x]) return x;
  p[x] = find(p[x]);
  return p[x];
}
void kr() {
  int i;
  cnt = 0;
  for (i = 1; i <= n; i++) p[i] = i;
  for (i = 0; i < m; i++) {
    int x = find(e[i].s);
    int y = find(e[i].t);
    if (x != y) {
      p[x] = y;
      cnt++;
    }
    if (cnt == n - 1) return;
  }
}
void init() {
  int i;
  memset(a, 0, sizeof(a));
  for (i = 0; i < m; i++) {
    int s, t;
    scanf("%d%d", &s, &t);
    e[i].s = s;
    e[i].t = t;
  }
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    init();
    kr();
    if (cnt == n - 1 && m == n)
      cout << "FHTAGN!" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
