#include <bits/stdc++.h>
using namespace std;
bool q(vector<vector<int>>& a, vector<int>& v, vector<int>& s, int i, int p) {
  v[i] = 1;
  s.push_back(i);
  for (int j = 0; j < a[i].size(); j++) {
    if (v[a[i][j]] == 0) {
      bool t = q(a, v, s, a[i][j], i);
      if (t) return true;
    } else if (a[i][j] != p) {
      s.push_back(a[i][j]);
      return true;
    }
  }
  s.pop_back();
  return false;
}
bool g(vector<vector<int>>& a, vector<int>& v, int& l, int i, vector<int> p) {
  v[i] = 1;
  l++;
  for (int j = 0; j < a[i].size(); j++) {
    if (v[a[i][j]] == 0) {
      bool t = g(a, v, l, a[i][j], {i});
      if (t) return true;
    } else if (find(p.begin(), p.end(), a[i][j]) == p.end()) {
      return true;
    }
  }
  return false;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(n);
  for (int i = 0; i < m; i++) {
    int s, e;
    cin >> s >> e;
    a[s - 1].push_back(e - 1);
    a[e - 1].push_back(s - 1);
  }
  vector<int> v(n), s;
  bool tt = q(a, v, s, 0, -1);
  if (tt == false) {
    cout << "NO" << endl;
    return 0;
  }
  vector<int> cm;
  vector<int> vn(n);
  int el = s[s.size() - 1];
  cm.push_back(el);
  vn[el] = 1;
  for (int j = s.size() - 2; j >= 0; j--) {
    if (s[j] == el) break;
    cm.push_back(s[j]);
    vn[s[j]] = 1;
  }
  int l = 0;
  for (auto i = 0; i < cm.size(); i++) {
    int x = cm[i];
    vector<int> vt;
    if (i > 0)
      vt.push_back(cm[i - 1]);
    else
      vt.push_back(cm[cm.size() - 1]);
    if (i < cm.size() - 1)
      vt.push_back(cm[i + 1]);
    else
      vt.push_back(cm[0]);
    bool ant = g(a, vn, l, x, vt);
    if (ant) {
      cout << "NO" << endl;
      return 0;
    }
  }
  if (l == n)
    cout << "FHTAGN!" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
