#include <bits/stdc++.h>
using namespace std;
int mat[105][105];
int nodes[105];
int n, m;
int cycles = 0;
void cycle_det(int cur, int parent);
int main() {
  cin >> n >> m;
  memset(mat, 0, sizeof mat);
  memset(nodes, 0, sizeof nodes);
  for (int i = 0; i < m; i++) {
    int _1, _2;
    cin >> _1 >> _2;
    mat[_1 - 1][_2 - 1] = 1;
    mat[_2 - 1][_1 - 1] = 1;
  }
  cycle_det(0, -1);
  int count = 0;
  for (int i = 0; i < n; i++)
    if (nodes[i] == 1) count++;
  if (cycles != 2 || count != n)
    cout << "NO\n";
  else
    cout << "FHTAGN!\n";
}
void cycle_det(int cur, int parent) {
  if (cycles > 2) return;
  nodes[cur] = 1;
  for (int i = 0; i < n; i++) {
    int tmp = 0;
    if (mat[cur][i] == 1 && !nodes[i]) {
      nodes[i] = 1;
      cycle_det(i, cur);
    } else if (mat[cur][i] == 1 && i != parent && nodes[i]) {
      cycles++;
    }
  }
}
