#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
inline T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
using namespace std;
bool e[101][101], vis[101];
int n, m;
void dfs(int v) {
  vis[v] = true;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    if (e[v][i]) dfs(i);
  }
}
bool solve() {
  dfs(1);
  for (int i = 1; i <= n; i++)
    if (!vis[i]) return false;
  return true;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    e[a][b] = e[b][a] = true;
  }
  if (n != m)
    cout << "NO" << endl;
  else {
    if (solve())
      cout << "FHTAGN!" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
