#include <bits/stdc++.h>
using namespace std;
using namespace std;
bool color[50000];
int par[50000];
int find(int a) {
  if (par[a] == a) return a;
  return par[a] = find(par[a]);
}
void Union(int a, int b) {
  if (find(a) != find(b)) par[find(b)] = find(a);
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i <= n; i++) par[i] = i;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    Union(x, y);
  }
  if (n != m) {
    cout << "NO" << endl;
    return 0;
  }
  m = find(1);
  for (int i = 2; i <= n; i++)
    if (find(i) != m) {
      cout << "NO" << endl;
      return 0;
    }
  cout << "FHTAGN!" << endl;
}
