#include <bits/stdc++.h>
using namespace std;
long long int visited[100000];
long long int len[100000];
long long int cycle = 0;
void dfs(long long int second, vector<long long int> v[]) {
  visited[second] = 1;
  long long int vp;
  for (long long int i = 0; i < v[second].size(); i++) {
    vp = v[second][i];
    if (visited[vp] == 0) {
      len[vp] = len[second] + 1;
      dfs(vp, v);
    } else if (visited[vp] == true && len[second] - len[vp] > 1) {
      cycle++;
    }
  }
}
int main() {
  long long int n, m, x, y;
  cin >> n >> m;
  vector<long long int> v[n + 1];
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1, v);
  if (cycle != 1)
    cout << "NO";
  else if (cycle == 1) {
    if (n == m) {
      for (int i = 1; i < n; i++) {
        if (visited[i] == false) {
          cout << "NO";
          return 0;
        }
      }
      cout << "FHTAGN!";
    } else
      cout << "NO";
  }
}
