#include <bits/stdc++.h>
using namespace std;
long long v, p[10005], ans, ans1, x, y, z, n, m;
pair<int, pair<int, int> > a[100005];
map<int, int> mp;
int get_col(int v) {
  if (v == p[v]) return v;
  p[v] = get_col(p[v]);
  return p[v];
}
void col(int a, int b) { p[get_col(a)] = get_col(b); }
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    mp[x]++;
    mp[y]++;
    z = 1;
    a[i].first = z;
    a[i].second.first = x;
    a[i].second.second = y;
  }
  for (int i = 1; i <= n; i++)
    if (mp[i] == 0) {
      cout << "NO";
      return 0;
    }
  sort(a + 1, a + m + 1);
  for (int i = 1; i <= n; i++) p[i] = i;
  for (int i = 1; i <= m; i++) {
    x = a[i].second.first;
    y = a[i].second.second;
    if (get_col(x) != get_col(y)) {
      col(get_col(x), get_col(y));
      ans += a[i].first;
    } else
      ans1++;
  }
  if (ans1 == 1)
    cout << "FHTAGN!" << endl;
  else
    cout << "NO";
}
