#include <bits/stdc++.h>
using namespace std;
void dfs(int v, vector<vector<int>>& g, vector<bool>& used) {
  if (!used[v]) {
    used[v] = true;
    for (auto u : g[v]) dfs(u, g, used);
  }
}
int cycle_vertex(int v, vector<vector<int>>& g, vector<bool>& used,
                 vector<int>& p) {
  if (used[v])
    return v;
  else {
    used[v] = true;
    for (auto u : g[v])
      if (u != p[v]) {
        p[u] = v;
        int t = cycle_vertex(u, g, used, p);
        if (t) return t;
      }
    return 0;
  }
}
bool is_tree(int v, pair<int, int> prev, vector<vector<int>>& g,
             vector<bool>& used) {
  if (used[v]) return false;
  used[v] = true;
  for (auto u : g[v])
    if (u != prev.first && u != prev.second)
      if (!is_tree(u, {v, 0}, g, used)) return false;
  return true;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(n + 1), cycle;
  vector<vector<int>> g(n + 1);
  vector<bool> used(n + 1);
  for (int i = 0; i < m; ++i) {
    int x1, x2;
    cin >> x1 >> x2;
    g[x1].push_back(x2);
    g[x2].push_back(x1);
  }
  int u = cycle_vertex(1, g, used, p);
  used.clear();
  used.resize(n + 1);
  dfs(1, g, used);
  int j = 1;
  while (j <= n && used[j]) ++j;
  if (j <= n || u == 0) {
    cout << "NO";
    return 0;
  }
  used.clear();
  used.resize(n + 1);
  cycle.push_back(u);
  for (u = p[u]; u != cycle[0]; u = p[u]) cycle.push_back(u);
  for (auto v : cycle) used[v] = true;
  for (int i = 0; i < cycle.size(); ++i) {
    used[cycle[i]] = false;
    if (!is_tree(cycle[i],
                 {cycle[(i - 1 + cycle.size()) % cycle.size()],
                  cycle[(i + 1) % cycle.size()]},
                 g, used)) {
      cout << "NO";
      return 0;
    }
  }
  cout << "FHTAGN!";
  return 0;
}
