#include <bits/stdc++.h>
int main() {
  int n, m;
  int col[200];
  int a, b;
  int i, j;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) col[i] = i;
  for (i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    a--;
    b--;
    for (j = 0, b = col[b]; j < n; j++)
      if (col[j] == b) col[j] = col[a];
  }
  for (i = 0; i < n - 1; i++)
    if (col[i] != col[i + 1]) {
      printf("NO\n");
      return 0;
    }
  if (n == m)
    printf("FHTAGN!\n");
  else
    printf("NO\n");
  return 0;
}
