#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
vector<vector<int> > g;
vector<int> state;
vector<int> st;
vector<int> cyc;
set<pair<int, int> > forbid;
int cnt;
void dfs(int u, int pr = -1) {
  cnt++;
  state[u] = 1;
  st.push_back(u);
  for (int i = 0; i < g[u].size(); ++i)
    if (g[u][i] != pr && !forbid.count(make_pair(u, g[u][i]))) {
      int v = g[u][i];
      if (state[v] == 0)
        dfs(v, u);
      else if (state[v] == 1 && cyc.size() == 0) {
        int j = st.size() - 1;
        while (st[j] != v) cyc.push_back(st[j]), --j;
        cyc.push_back(v);
      }
    }
  state[u] = 2;
  st.pop_back();
}
int n;
int main() {
  cin >> n;
  int m;
  cin >> m;
  g.resize(n);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  state.resize(n);
  dfs(0);
  if (count(state.begin(), state.end(), 0) > 0 || cyc.size() == 0) {
    cout << "NO" << endl;
    return 0;
  }
  if (n != m) {
    cout << "NO" << endl;
  } else {
    cout << "FHTAGN!" << endl;
  }
  return 0;
  for (int i = 0; i < cyc.size(); ++i) {
    int j = (i + 1) % cyc.size();
    forbid.insert(make_pair(cyc[i], cyc[j]));
    forbid.insert(make_pair(cyc[j], cyc[i]));
  }
  int tries = 0;
  state.assign(n, 0);
  for (int i = 0; i < n; ++i)
    if (state[i] == 0) {
      tries++;
      cyc.clear();
      st.clear();
      cnt = 0;
      dfs(i);
      if (cyc.size() > 0) {
        cout << "NO" << endl;
        return 0;
      }
    }
  if (tries < 3) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "FHTAGN!" << endl;
  return 0;
}
