#include <bits/stdc++.h>
using namespace std;
int find_parent(int a, int *parent) {
  if (parent[a] == a) return a;
  return find_parent(parent[a], parent);
}
int dfs(int u, int v, vector<vector<int>> &adj, bool *visited) {
  visited[u] = true;
  if (u == v) return 0;
  int myres = INT_MIN;
  for (int i = 0; i < adj[u].size(); i++) {
    int s = adj[u][i];
    if (!visited[s]) myres = max(myres, 1 + dfs(s, v, adj, visited));
  }
  return myres;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> adj(n + 1);
  int *parent = new int[n + 1];
  for (int i = 1; i <= n; i++) parent[i] = i;
  bool temp = false;
  bool *visited = new bool[n + 1];
  for (int i = 0; i <= n; i++) visited[i] = false;
  int ln;
  int myx = -1;
  int myy = -1;
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    ln = a;
    int g = find_parent(a, parent);
    int e = find_parent(b, parent);
    parent[g] = e;
    if (g == e) {
      cnt++;
      temp = true;
      myx = a;
      myy = b;
    }
  }
  if (!temp || cnt > 1 || n == m + 1)
    cout << "NO" << endl;
  else {
    int k = dfs(myx, myy, adj, visited);
    if (k >= 2)
      cout << "FHTAGN!" << endl;
    else
      cout << "-1" << endl;
  }
}
