#define _USE_MATH_DEFINES

#include <cmath>
#include <cstdio>

#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define mp make_pair
#define pb push_back

#define DEBUG(x) cout << #x << ": " << (x) << endl;

int u[110];
int getU(int x)
{
    if (u[x] == x)
        return x;
    return getU(u[x]);
}
void addU(int x, int y)
{
    if (rand()&1)
        u[getU(x)] = getU(y);
    else u[getU(y)] = getU(x);
}

int main() {
#ifndef ONLINE_JUDGE
    freopen( "1.txt", "rt", stdin );
    //freopen("output.txt", "wt", stdout);
#endif

    int n, m;
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
        u[i] = i;

    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        addU(a,b);
    }

    set<int> res;
    for (int i = 1; i <= n; i++)
        res.insert(getU(u[i]));

    if (res.size() != 1 || n != m)
        cout << "NO";
    else
        cout << "FHTAGN!";

    return ( 0 );
}


#include<iostream>
using namespace std;
bool A[101][101];
bool Vis[101];
int n,m;
bool solve(int i,int pre_i=-1)
{
    if(Vis[i])
    {
        A[i][pre_i]=A[pre_i][i]=0;
        return 1;
    }
    Vis[i]=1;
    bool b=0;
    for(int j=1; j<=n; ++j)
        if(A[i][j]&&j!=pre_i)
            b=b||solve(j,i);
    return b;
}
void dfs(int i)
{
    Vis[i]=1;
    for(int j=1; j<=n; ++j)
        if(!Vis[j]&&A[i][j])
            dfs(j);
}
int main()
{
    int x,y,z=0;
    cin>>n>>m;

    for(int i=0; i<m ;++i) {
        cin>>x>>y;
        A[y][x]=A[x][y]=1;
    }
    int c=0;
    for(int i=1; i<=n; ++i) {
        if(!Vis[i])++c;
        dfs(i);
    }
    memset(Vis,0,sizeof(Vis));
    for(int i=1; i<=n; ++i) {
        if(solve(i))
            ++z;
            memset(Vis,0,sizeof(Vis));
    }
    if(c==1&&z==1)cout<<"FHTAGN!";
    else cout<<"NO";
    return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int n,m;
vector<vector<int>>arr;
bool check[101];
bool ans;
void dfs(int node,int parent,int count) {
	check[node] = true;
	if (check[node] && count >= 2) {
		ans = true;

	}
	for (int i = 0; i < arr[node].size(); i++) {
		if (arr[node][i] != parent&&!check[arr[node][i]]) {
			count++;
			dfs(arr[node][i], node, count);
		}
	}
}
int main()
{
	cin >> n >> m;
	arr.resize(n + 1);
	ans = false;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	for (int i = 1; i <= n; i++) {
		dfs(i,0,1);
		if (ans) {
			cout << "FHTAGN!" << endl;
			return 0;
		}
	}
	cout << "NO";
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int n, m;
vector<vector<int>>arr;
bool check[101];
bool ans;
void dfs(int node, int parent, int count) {
	check[node] = true;
	count++;

	if (check[node] && count >= 2) {
		ans = true;
	}
	for (int i = 0; i < arr[node].size(); i++) {

		if (arr[node][i] != parent && !check[arr[node][i]]) {
			/*cout << node<<" " <<arr[node][i]<<" "<<count << endl;*/
			dfs(arr[node][i], node, count);
		}
	}
}
int main()
{
	cin >> n >> m;
	arr.resize(n + 1);
	ans = false;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	for (int i = 1; i <= n; i++) {
		dfs(i, 0, 1);
		if (ans) {
			cout << "FHTAGN!" << endl;
			return 0;
		}

	}
	cout << "NO";
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int n, m;
vector<vector<int>>arr;
bool check[101];
bool ans;
void dfs(int node,int nextnode, int parent, int count) {
	nextnode = node;
	/*if (check[node] && count >= 2) {
		ans = true;
	}*/
	check[nextnode] = true;
	count++;

	for (int i = 0; i < arr[nextnode].size(); i++) {
		if (arr[nextnode][i] == node && count >= 2) {
			ans = true;
		}
		if (arr[nextnode][i] != parent && !check[arr[nextnode][i]]) {
			/*cout << node<<" " <<arr[node][i]<<" "<<count <<" "<<ans<< endl;*/
			dfs(node,arr[nextnode][i], nextnode, count);
		}
	}
}
int main()
{
	cin >> n >> m;
	arr.resize(n + 1);
	ans = false;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	for (int i = 1; i <= n; i++) {
		dfs(i,0, 0, 1);
		if (ans) {
			cout << "FHTAGN!" << endl;
			return 0;
		}

	}
	cout << "NO";
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int n, m;
vector<vector<int>>arr;
bool check[101];
bool ans;
void dfs(int node, int parent, int count) {
	if (check[node] && count >= 2) {
		ans = true;
	}
	check[node] = true;
	count++;

	for (int i = 0; i < arr[node].size(); i++) {

		if (arr[node][i] != parent && !check[arr[node][i]]) {
			/*cout << node<<" " <<arr[node][i]<<" "<<count <<" "<<ans<< endl;*/
			dfs(arr[node][i], node, count);
		}
	}
}
int main()
{
	cin >> n >> m;
	arr.resize(n + 1);
	ans = false;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	for (int i = 1; i <= n; i++) {
		dfs(i, 0, 1);
		if (ans) {
			cout << "FHTAGN!" << endl;
			return 0;
		}

	}
	cout << "NO";
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int n, m;
vector<vector<int>>arr;
bool check[101];
bool ans;
void dfs(int node, int parent, int count) {
	check[node] = true;
	if (check[node] && count >= 2) {
		ans = true;

	}
	for (int i = 0; i < arr[node].size(); i++) {
		count++;
		if (arr[node][i] != parent && !check[arr[node][i]]) {
			cout << node<<" " <<arr[node][i]<<" "<<count << endl;
			dfs(arr[node][i], node, count);
		}
	}
}
int main()
{
	cin >> n >> m;
	arr.resize(n + 1);
	ans = false;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	for (int i = 1; i <= n; i++) {
		dfs(i, 0, 1);
		if (ans) {
			cout << "FHTAGN!" << endl;
			return 0;
		}

	}
	cout << "NO";
	return 0;
}


#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<queue>

using namespace std;
int color[101],c;
vector<int> ar[5000];
void dfs(int j)
{
	c++,color[j]=1;
	for(int i=0;i<ar[j].size();i++) if(color[ar[j][i]]==0) dfs(ar[j][i]);
}
int main()
{
	int n,m,v1,v2;
	cin>>n>>m;
	for(int i=0;i<m;i++) cin>>v1>>v2,ar[v1].push_back(v2),ar[v2].push_back(v1);
	if(m!=n)  cout<<"NO";
	else {
		dfs(1);
		if(c==n) cout<<"FHTAGN!";else cout<<"NO";
	}
	//getch();
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int n,m;
vector<vector<int>>arr;

bool ans;
bool *check;
void dfs(int node,int parent,int count) {
	check[node] = true;
	if (check[node] && count >= 2) {
		ans = true;

	}
	for (int i = 0; i < arr[node].size(); i++) {
		if (arr[node][i] != parent&&!check[arr[node][i]]) {
			count++;
			dfs(arr[node][i], node, count);
		}
	}
}
int main()
{
	cin >> n >> m;
	arr.resize(n + 1);
	ans = false;
	bool check[101];
	for (int i = 0; i < 101; i++) {
		check[i] = false;
	}
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	for (int i = 1; i <= n; i++) {
		dfs(i,0,1);
		if (ans) {
			cout << "FHTAGN!" << endl;
			return 0;
		}
	}
	cout << "NO";
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int n, m;
vector<vector<int>>arr;
bool check[101];
bool ans;
void dfs(int node, int parent, int count) {
	if (check[node] && count >= 2) {
		ans = true;
	}
	check[node] = true;
	count++;

	for (int i = 0; i < arr[node].size(); i++) {

		if (arr[node][i] != parent && !check[arr[node][i]]) {
			cout << node<<" " <<arr[node][i]<<" "<<count <<" "<<ans<< endl;
			dfs(arr[node][i], node, count);
		}
	}
}
int main()
{
	cin >> n >> m;
	arr.resize(n + 1);
	ans = false;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	for (int i = 1; i <= n; i++) {
		dfs(i, 0, 1);
		if (ans) {
			cout << "FHTAGN!" << endl;
			return 0;
		}

	}
	cout << "NO";
	return 0;
}


#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <bitset>
#include <list>
#include <iterator>
#include <functional>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) (x).begin(), (x).end()

#pragma comment(linker, "/STACK:64000000")

const double PI = 3.1415926535897932384626433832795;
const LL ONE = 1LL;
const double EPS = 1e-8;

LL gcd(LL a, LL b)
{
    return (b)? gcd(b, a%b):a;
}

LL max(LL a, LL b)
{
    return (a>b)?a:b;
}

LL min(LL a, LL b)
{
    return (a<b)?a:b;
}

struct Point
{
    ULL x,y;
    Point(ULL _x = 0, ULL _y = 0):
    x(_x),
    y(_y)
    {}
    void Read()
    {
        cin >> x >> y ;
    }

    double Dist(Point a)
    {
        return sqrt((double)((a.x-x)*(a.x-x)+(a.y-y)*(a.y-y)));
    }
};

typedef pair<long long, long long> pint;

bool operator <(pint a, pint b)
{
    if(a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

vector<int> col;
vector< vector<int> > g;

bool dfs1(int u, int from)
{
    if(col[u] == 2) return false;

    if(col[u] == 1)
    {
        return true;
    }
    col[u] = 1;

    for(int i=0; i<g[u].size(); ++i)
    {
        if(g[u][i] == from)
            continue;
        if(dfs1(g[u][i], u))
        {
            return true;
        }
    }

    col[u] = 2;
    return false;
}

bool paint(int u, int c, int from)
{
    if(col[u] == 1)
        return false;
    if(col[u] > 2)
    {
        return true;
    }
    col[u] = c;
    bool fl = false;
    for(int i=0; i<g[u].size(); ++i)
    {
        if(g[u][i] != from)
        {
            fl |= paint(g[u][i], c, u);
        }
    }
    return fl;
}

int main()
{
    //freopen("readme.txt", "r", stdin);
    int n,m;
    cin >> n >> m;
    g.resize(n);
    col.resize(n, 0);
    int u,v;
    for(int i=0; i<m; ++i)
    {
        cin >> u >> v;
        u--;v--;
        g[u].pb(v);
        g[v].pb(u);
    }

    bool fl = false;
    for(int i=0; i<n; ++i)
    {
        if(dfs1(i, -1))
        {
            fl = true;
            break;
        }
    }

    if(!fl)
    {
        cout << "NO" << endl;
        return 0;
    }
    fl = false;
    for(int i=0; i<n; ++i)
    {
        if(col[i]==1)
        {
            for(int j=0; j<g[i].size(); ++j)
            {
                fl |= paint(g[i][j],i+10, -1);
            }
        }
    }

	for(int i=0; i<n; ++i)
	{
		fl&=col[i]!=0;
	}

    if(!fl)
    cout << "FHTAGN!" << endl;
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <bitset>
#include <list>
#include <iterator>
#include <functional>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) (x).begin(), (x).end()

#pragma comment(linker, "/STACK:64000000")

const double PI = 3.1415926535897932384626433832795;
const LL ONE = 1LL;
const double EPS = 1e-8;

LL gcd(LL a, LL b)
{
    return (b)? gcd(b, a%b):a;
}

LL max(LL a, LL b)
{
    return (a>b)?a:b;
}

LL min(LL a, LL b)
{
    return (a<b)?a:b;
}

struct Point
{
    ULL x,y;
    Point(ULL _x = 0, ULL _y = 0):
    x(_x),
    y(_y)
    {}
    void Read()
    {
        cin >> x >> y ;
    }

    double Dist(Point a)
    {
        return sqrt((double)((a.x-x)*(a.x-x)+(a.y-y)*(a.y-y)));
    }
};

typedef pair<long long, long long> pint;

vector<vector<int>> g;

vector<int> col;

void dfs(int u, int from)
{
    col[u] = 1;
    for(int i=0; i<g[u].size(); ++i)
    {
        if(g[u][i]!=from)
        {
            dfs(g[u][i], u);
        }
    }
}

int main()
{
    int n,m;
    cin >> n >> m;
    g.resize(n);
    col.resize(n, 0);
    int u,v;
    for(int i=0; i<n; ++i)
    {
        cin >> u >> v;
        --u;--v;
        g[u].pb(v);
        g[v].pb(u);
    }

    dfs(0,-1);

    bool fl = n==m;

    for(int i=0; i<n; ++i)
    {
        fl &= col[i]==1;
    }

    if(fl)
    {
        cout << "FHTAGN!" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <bitset>
#include <list>
#include <iterator>
#include <functional>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) (x).begin(), (x).end()

#pragma comment(linker, "/STACK:64000000")

const double PI = 3.1415926535897932384626433832795;
const LL ONE = 1LL;
const double EPS = 1e-8;

LL gcd(LL a, LL b)
{
    return (b)? gcd(b, a%b):a;
}

LL max(LL a, LL b)
{
    return (a>b)?a:b;
}

LL min(LL a, LL b)
{
    return (a<b)?a:b;
}

struct Point
{
    ULL x,y;
    Point(ULL _x = 0, ULL _y = 0):
    x(_x),
    y(_y)
    {}
    void Read()
    {
        cin >> x >> y ;
    }

    double Dist(Point a)
    {
        return sqrt((double)((a.x-x)*(a.x-x)+(a.y-y)*(a.y-y)));
    }
};

typedef pair<long long, long long> pint;

vector<vector<int>> g;

vector<int> col;

void dfs(int u, int from)
{
    col[u] = 1;
    for(int i=0; i<g[u].size(); ++i)
    {
        if(g[u][i]!=from && col[g[u][i]]==0)
        {
            dfs(g[u][i], u);
        }
    }
}

int main()
{
    int n,m;
    cin >> n >> m;
    g.resize(n);
    col.resize(n, 0);
    int u,v;
    for(int i=0; i<m; ++i)
    {
        cin >> u >> v;
        --u;--v;
        g[u].pb(v);
        g[v].pb(u);
    }

    dfs(0,-1);

    bool fl = n==m;

    for(int i=0; i<n; ++i)
    {
        fl &= col[i]==1;
    }

    if(fl)
    {
        cout << "FHTAGN!" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <bitset>
#include <list>
#include <iterator>
#include <functional>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) (x).begin(), (x).end()

#pragma comment(linker, "/STACK:64000000")

const double PI = 3.1415926535897932384626433832795;
const LL ONE = 1LL;
const double EPS = 1e-8;

LL gcd(LL a, LL b)
{
    return (b)? gcd(b, a%b):a;
}

LL max(LL a, LL b)
{
    return (a>b)?a:b;
}

LL min(LL a, LL b)
{
    return (a<b)?a:b;
}

struct Point
{
    ULL x,y;
    Point(ULL _x = 0, ULL _y = 0):
    x(_x),
    y(_y)
    {}
    void Read()
    {
        cin >> x >> y ;
    }

    double Dist(Point a)
    {
        return sqrt((double)((a.x-x)*(a.x-x)+(a.y-y)*(a.y-y)));
    }
};

typedef pair<long long, long long> pint;

vector<vector<int>> g;

vector<int> col;

void dfs(int u, int from)
{
    col[u] = 1;
    for(int i=0; i<g[u].size(); ++i)
    {
        if(g[u][i]!=from && col[g[u][i]]==0)
        {
            dfs(g[u][i], u);
        }
    }
}

int main()
{
    int n,m;
    cin >> n >> m;
    g.resize(n);
    col.resize(n, 0);
    int u,v;
    for(int i=0; i<n; ++i)
    {
        cin >> u >> v;
        --u;--v;
        g[u].pb(v);
        g[v].pb(u);
    }

    dfs(0,-1);

    bool fl = n==m;

    for(int i=0; i<n; ++i)
    {
        fl &= col[i]==1;
    }

    if(fl)
    {
        cout << "FHTAGN!" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

const int size = 101;
vector<int> edges[size];
bool visited[size];

void visit(int u)
{
    visited[u] = true;

    for(int i = 0; i < edges[u].size(); ++i) {
        int v = edges[u][i];

        if(!visited[v])
            visit(v);
    }
}

int main()
{
    int n, m;
    cin >> n >> m;

    if(n != m || n < 3) {
        cout << "NO";
        return 0;
    }

    for(int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;

        edges[u].push_back(v);
        edges[v].push_back(u);
    }

    visit(1);

    for(int i = 1; i <= n; ++i) {
        if(!visited[i]) {
            cout << "NO";
            return 0;
        }
    }

    cout << "FHTAGN!";

    return 0;
}
/*
входные данные
6 6
6 3
6 4
5 1
2 5
1 4
5 4
выходные данные
FHTAGN!
входные данные
6 5
5 6
4 6
3 1
5 1
1 2
выходные данные
NO
Ввод
6 6
1 2
2 3
3 1
4 5
5 6
6 4
Вывод
FHTAGN!
Ответ
NO
*/


#include <iostream>

using namespace std;

const int size = 101;
int degree[size];

int main()
{
    int n, m;
    cin >> n >> m;

    if(n != m || n < 3) {
        cout << "NO";
        return 0;
    }

    for(int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;

        ++degree[u];
        ++degree[v];
    }

    for(int i = 1; i <= n; ++i) {
        if(degree[i] == 0) {
            cout << "NO";
            return 0;
        }
    }

    cout << "FHTAGN!";

    return 0;
}
/*
входные данные
6 6
6 3
6 4
5 1
2 5
1 4
5 4
выходные данные
FHTAGN!
входные данные
6 5
5 6
4 6
3 1
5 1
1 2
выходные данные
NO
*/


#include<iostream>
#include<vector>
using namespace std;
int n,m,x,y;
vector<int> arr[100];
bool vis[100];
void dfs(int x)
{
	if(vis[x])
		return;
	vis[x]=true;
	for(int i=0;i<arr[x].size();i++)
		dfs(arr[x][i]);
}
int main()
{
	cin>>n>>m;
	memset(vis,0,sizeof vis);
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		arr[x-1].push_back(y-1);
		arr[y-1].push_back(x-1);
	}
	if(n!=m)
		cout<<"NO";
	else
	{
		dfs(arr[0][0]);
		for(int j=0;j<m;j++)
			if(!vis[j])
			{
				cout<<"NO";
				return 0;
			}
		cout<<"FHTAGN!";
	}
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n,m,x,y;
vector<int> arr[105];
bool vis[105];
void dfs(int x)
{
	if(vis[x])
		return;
	vis[x]=true;
	for(int i=0;i<arr[x].size();i++)
		dfs(arr[x][i]);
}
int main()
{
	cin>>n>>m;
	memset(vis,0,sizeof vis);
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		arr[x-1].push_back(y-1);
		arr[y-1].push_back(x-1);
	}
	if(n!=m)
		cout<<"NO";
	else
	{
		dfs(arr[0][0]);
		for(int j=0;j<m;j++)
			if(!vis[j])
			{
				cout<<"NO";
				return 0;
			}
		cout<<"FHTAGN!";
	}
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int n,m,x,y;
vector<int> arr[105];
bool vis[105];
void dfs(int x)
{
	if(vis[x])
		return;
	vis[x]=true;
	for(int i=0;i<arr[x].size();i++)
		dfs(arr[x][i]);
}
int main()
{
	cin>>n>>m;
	memset(vis,0,sizeof vis);
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		arr[x-1].push_back(y-1);
		arr[y-1].push_back(x-1);
	}
	if(n!=m)
		cout<<"NO";
	else
	{
		dfs(arr[x-1][0]);
		for(int j=0;j<m;j++)
			if(!vis[j])
			{
				cout<<"NO";
				return 0;
			}
		cout<<"FHTAGN!";
	}
	return 0;
}


#include <stdio.h>

char g[101][101], col[101];
int n, par[101];

int dfs(int s)
{
    int i;
    col[s]=1;
    for(i=1; i<=n; i++)
        if (g[s][i])
        {
            if (col[i] && par[s]!=i)
            {g[s][i]=g[i][s]=0; return 1;}
            else if (!col[i]) {par[i]=s; if (dfs(i)) return 1;}
        }
    return 0;
}

int main()
{
    int i, a, b, m;
    scanf("%d %d", &n, &m);
    if (n!=m) {printf("NO"); return 0;}
    for(i=0; i<m; i++)
    {
        scanf("%d %d", &a, &b);
        g[a][b]=g[b][a]=1;
    }
    for(i=1; i<=n; i++) par[i]=-1;
    if (!dfs(1))
    {printf("NO"); return 0;}
    for(i=1; i<=n; i++) {col[i]=0; par[i]=-1;}
    if (dfs(1))
    {printf("NO"); return 0;}
    for(i=1; i<=n; i++) if (!col[i])
    {printf("NO"); return 0;}
    printf("FHTAGN!");
}


#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>
#include <set>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <utility>
#define mp(a, b) make_pair(a, b)

using namespace std;

vector <vector <int> > g;
vector <int> p;
int n, cl[100], cend, cst = -1, m;

bool dfs(int from)
{
	cl[from] = 1;
	for (int i = 0; i < g[from].size(); i++)
	{
		int to = g[from][i];
		if (cl[to] == 0)
		{
			p[to] = from;
			if (dfs(to)) return true;
		}
		else if (cl[to] == 1 && p[from] != to)
		{
			cend = from;
			cst = to;
			return true;
		}
	}
	cl[from] = 2;
	return false;
}

int main ()
{
	cin >> n >> m;
	p.assign(n, -1);
	g.resize(n);
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		g[a - 1].push_back(b - 1);
		g[b - 1].push_back(a - 1);
	}
	if (dfs(0)) cout << "FHTAGN!";
	else cout << "NO";
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>
#include <set>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <utility>
#define mp(a, b) make_pair(a, b)

using namespace std;

int n, m, g[100][100], u[100], k;

void dfs(int from)
{
	u[from] = 1;
	k++;
	for (int i = 0; i < n; i++)
	{
		if(!u[i] && g[from][i]) dfs(i);
	}
}

int main ()
{
	cin >> n >> m;
	if (n != m) {cout << "NO"; return 0;}
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		g[a - 1][b - 1] = g[b - 1][a - 1] = 1;
	}
	dfs(0);
	if (k == n) cout << "FHTAGN!";
	else cout << "NO";
	return 0;
}


#include <functional>
#include <algorithm>
#include <utility>
#include <cassert>
#include <cmath>
#include <ctime>

#include <numeric>
#include <iomanip>
#include <complex>
#include <float.h>
#include <cfloat>

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstdio>

#include <cstring>
#include <string>

#include <iterator>
#include <vector>
#include <bitset>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
using namespace std;

#define foreach(it, v, type) for( type::iterator it = v.begin(); it != v.end() ; it++)
#define forn(i, st, en) for(int i = (int)(st); i <= (int)(en); i++)
#define ford(i, en, st) for(int i = (int)(en); i >= (int)(st); i--)
#define zero(a, w) memset(a, w, sizeof(a))
#define all(a) a.begin(), a.end()
#define sz(a) a.size()

#define msg(x) cout << #x << " = " << x << endl;

int n, m;
bool edge[110][110], was[110];

void dfs(int u) {
    was[u] = true;
    for(int v = 0; v < m; ++v)
        if(!was[v] && edge[u][v])
            dfs(v);
}

int main() {
 // freopen("input.txt","r",stdin);
 // freopen("output.txt","w",stdout);
 cin >> m >> n;
 memset(edge, 0, sizeof(edge));
 for(int i = 0; i < n; ++i) {
     int x, y;
     cin >> x >> y;
     -- x, -- y;
     edge[x][y] = true;
     edge[y][x] = true;
 }
 if(m != n) {
     cout << "NO";
     return 0;
 }
 for(int i = 0; i < m; ++i)
     for(int j = 0; j < m; ++j)
         if(edge[i][j]) {
             edge[i][j] = edge[j][i] = false;
             memset(was, 0, sizeof(was));
             dfs(i);
             bool ok = true;
             for(int u = 0; u < m; ++u)
                 if(!was[u]) {
                     ok = false;
                     break;
                 }
             if(ok) {
                 cout << "FHTAGN!";
                 return 0;
             }
             edge[i][j] = edge[j][j] = true;
         }

 cout << "NO";
 return 0;
}


#include <functional>
#include <algorithm>
#include <utility>
#include <cassert>
#include <cmath>
#include <ctime>

#include <numeric>
#include <iomanip>
#include <complex>
#include <float.h>
#include <cfloat>

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <cstdio>

#include <cstring>
#include <string>

#include <iterator>
#include <vector>
#include <bitset>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
using namespace std;

#define foreach(it, v, type) for( type::iterator it = v.begin(); it != v.end() ; it++)
#define forn(i, st, en) for(int i = (int)(st); i <= (int)(en); i++)
#define ford(i, en, st) for(int i = (int)(en); i >= (int)(st); i--)
#define zero(a, w) memset(a, w, sizeof(a))
#define all(a) a.begin(), a.end()
#define sz(a) a.size()

#define msg(x) cout << #x << " = " << x << endl;

int n, m, ci = 0;
bool edge[110][110], was[110];

void dfs(int u, int prev) {
    was[u] = true;
    for(int v = 0; v < m; ++v)
        if(!was[v] && edge[u][v])
            dfs(v, u); else
        if(was[v] && edge[u][v] && v != prev)
            ++ ci;
}

int main() {
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    cin >> m >> n;
    memset(edge, 0, sizeof(edge));
    for(int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        -- x, -- y;
        edge[x][y] = true;
        edge[y][x] = true;
    }

    memset(was, 0, sizeof(was));
    dfs(0, -1);
    for(int i = 0; i < m; ++i)
        if(!was[i]) {
            cout << "NO";
            return 0;
        }

    if(ci == 2)
        cout << "FHTAGN!"; else
        cout << "NO";
    return 0;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#include <iostream>
#include <queue>
#include <ctime>
#pragma comment(linker, "/STACK:16777216")
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int , int> pii;
typedef vector <int> vi;
typedef vector <pii> vii;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin() , (x).end()
#define forit(it, v) for (it = (v).begin(); it != (v).end(); ++it)
#define forn(i, n) for (int i = 0; i < ((int)(n)); ++i)
#define forab(i, a, b) for (int i = (int)(a); i < ((int)(b)); ++i)
#define y0 y123456789
#define y1 y234895
#define hash hash123456789
#define rank rank123456789
#define sz(x) ((int) (x).size() )
#define re return
#define sqr(x) ((x) * (x))

const double pi = 3.141592653589793238462;
const int nmax = 200000;
const int hash_base = 119;
const long long inf = 2e18;

int used[nmax] , cst , cend , n , m , parent[nmax];
vector <int> graph[nmax];
bool cls = false;
bool find_cycle(int v , int par)
{
    used[v] = 1;
    for (int i = 0 ; i < graph[v].size() ; i ++ )
    {
        int to = graph[v][i];
        if ( to == par || used[to] == 2)
            continue;
        if ( used[to] == 0 )
        {
            parent[to] = v;
            find_cycle(to , v) ;
        }
        else
        {
            cst = v;
            cend = to;
            cls = true;
        };
    };
    used[v] = 2;
    return false;
};

int main()
{
scanf("%d%d",&n,&m);
for (int i = 1 ; i <= m ; i ++ )
{
    int l , r;
    scanf("%d%d",&l,&r);
    graph[l].pb(r);
    graph[r].pb(l);
};
find_cycle(1 , -1);
if ( !cls )
    printf("NO\n");
else
{
    for (int i = 1 ; i <= n ; i ++ )
        if ( used[i] != 2 )
        {
            printf("NO\n");
            return 0;
        };
    printf("FHTAGN!\n");
};
return 0;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#include <iostream>
#include <queue>
#include <ctime>
#pragma comment(linker, "/STACK:16777216")
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int , int> pii;
typedef vector <int> vi;
typedef vector <pii> vii;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin() , (x).end()
#define forit(it, v) for (it = (v).begin(); it != (v).end(); ++it)
#define forn(i, n) for (int i = 0; i < ((int)(n)); ++i)
#define forab(i, a, b) for (int i = (int)(a); i < ((int)(b)); ++i)
#define y0 y123456789
#define y1 y234895
#define hash hash123456789
#define rank rank123456789
#define sz(x) ((int) (x).size() )
#define re return
#define sqr(x) ((x) * (x))

const double pi = 3.141592653589793238462;
const int nmax = 200000;
const int hash_base = 119;
const long long inf = 2e18;

int used[nmax] , cst , cend , n , m , parent[nmax];
vector <int> graph[nmax];
bool cls = false;
bool find_cycle(int v , int par)
{
    used[v] = 1;
    for (int i = 0 ; i < graph[v].size() ; i ++ )
    {
        int to = graph[v][i];
        if ( to == par || used[to] == 2)
            continue;
        if ( used[to] == 0 )
        {
            parent[to] = v;
            find_cycle(to , v) ;
        }
        else
        {
            cst = v;
            cend = to;
            cls = true;
        };
    };
    used[v] = 2;
    return false;
};

int main()
{
scanf("%d%d",&n,&m);
for (int i = 1 ; i <= m ; i ++ )
{
    int l , r;
    scanf("%d%d",&l,&r);
    graph[l].pb(r);
    graph[r].pb(l);
};
find_cycle(1 , -1);
if ( n != m )
    printf("NO\n");
else
{
    for (int i = 1 ; i <= n ; i ++ )
        if ( used[i] != 2 )
        {
            printf("NO\n");
            return 0;
        };
    printf("FHTAGN!\n");
};
return 0;
}


#include <iostream>
#include <fstream>
#include <set>
using namespace std;

const int N = 101;

int A[N][N];
bool visited[N];
bool result=false;

set<pair<int, int>> ss1;

void DFS(int s)
{
	visited[s] = true;
	set<pair<int, int>>::iterator p;
	for(int i=0; i<7; i++)
	{
		if(A[s][i]==1)
		{
			if(visited[i]!=1)
			{
				ss1.insert(make_pair(min(s,i),max(s,i)));
				DFS(i);
				//cout<<last<<endl;
			}
			else
			{
				p = ss1.find(make_pair(min(s,i),max(s,i)));
				if(p==ss1.end())
				{
					result=true;
				}
			}
		}
	}
}

int main()
{
	ifstream ff("file.txt");
	int n, m;
	cin>>n>>m;
	while(m--)
	{
		int x, y;
		cin>>x>>y;
		A[x][y] = 1;
		A[y][x] = 1;
	}

	for(int i=1; i<=n; i++)
	{
		memset(visited,0,N);
		DFS(i);
		ss1.clear();
		if(result==true)
		{
			cout<<"FHTAGN!"<<endl;
			return 0;
		}
	}

	cout<<"NO"<<endl;
	return 0;
}


#include <iostream>
#include <fstream>
#include <set>
using namespace std;

const int N = 101;

int A[N][N];
bool visited[N];
bool result=false;

set<pair<int, int>> ss1;

void DFS(int s)
{
	visited[s] = true;
	set<pair<int, int>>::iterator p;
//	cout<<s<<endl;
	for(int i=0; i<N; i++)
	{
		if(A[s][i]==1)
		{
			if(visited[i]!=1)
			{
			//	cout<<min(s,i)<<' '<<max(s,i)<<endl;
				ss1.insert(make_pair(min(s,i),max(s,i)));
				DFS(i);
				//cout<<last<<endl;
			}
			else
			{
				p = ss1.find(make_pair(min(s,i),max(s,i)));
				if(p==ss1.end())
				{
					result=true;
				}
			}
		}
	}
}

int main()
{
	ifstream ff("file.txt");
	int n, m;
	cin>>n>>m;
	while(m--)
	{
		int x, y;
		cin>>x>>y;
		A[x][y] = 1;
		A[y][x] = 1;
	}

	for(int i=1; i<=n; i++)
	{
		memset(visited,0,N);
		DFS(i);
		ss1.clear();
		if(result==true)
		{
			cout<<"FHTAGN!"<<endl;
			return 0;
		}
	}

	cout<<"NO"<<endl;
	return 0;
}


#include <iostream>
#include <fstream>
#include <set>
using namespace std;

const int N = 101;

int A[N][N];
bool visited[N];
bool result=false;

set<pair<int, int>> ss1;
set<int> s1;

void DFS(int s)
{
	s1.insert(s);
	visited[s] = true;
	set<pair<int, int>>::iterator p;
//	cout<<s<<endl;
	for(int i=0; i<N; i++)
	{
		if(A[s][i]==1)
		{
			if(visited[i]!=1)
			{
			//	cout<<min(s,i)<<' '<<max(s,i)<<endl;
				ss1.insert(make_pair(min(s,i),max(s,i)));
				DFS(i);
				//cout<<last<<endl;
			}
			else
			{
				p = ss1.find(make_pair(min(s,i),max(s,i)));
				if(p==ss1.end())
				{
					//cout<<i<<' '<<s<<endl;
					result=true;
				}
			}
		}
	}
}

int main()
{
	ifstream ff("file.txt");
	int n, m;
	cin>>n>>m;
	while(m--)
	{
		int x, y;
		cin>>x>>y;
		A[x][y] = 1;
		A[y][x] = 1;
	}

	DFS(1);
	if(result==true && s1.size()==n)
	{
		cout<<"FHTAGN!"<<endl;
		return 0;
	}
	/*
	for(int i=1; i<=n; i++)
	{
		memset(visited,0,N);

		ss1.clear();

	}
	*/
	cout<<"NO"<<endl;
	return 0;
}


#include <iostream>
#include <fstream>
#include <set>
using namespace std;

const int N = 101;

int A[N][N];
bool visited[N];
bool result=false;
enum Newer {Nothin, One, More};
Newer Pos=Nothin;

set<pair<int, int>> ss1;
set<int> s1;

void DFS(int s)
{
	s1.insert(s);
	visited[s] = true;
	set<pair<int, int>>::iterator p;
//	cout<<s<<endl;
	for(int i=0; i<N; i++)
	{
		if(A[s][i]==1)
		{
			if(visited[i]!=1)
			{
			//	cout<<min(s,i)<<' '<<max(s,i)<<endl;
				ss1.insert(make_pair(min(s,i),max(s,i)));
				DFS(i);
				//cout<<last<<endl;
			}
			else
			{
				p = ss1.find(make_pair(min(s,i),max(s,i)));
				if(p==ss1.end())
				{
					ss1.insert(make_pair(min(s,i),max(s,i)));
					//cout<<i<<' '<<s<<endl;
					result=true;
					if(Pos==Nothin)
					{
						Pos=One;
					}
					else
					{
						Pos=More;
					}
				}
			}
		}
	}
}

int main()
{
	ifstream ff("file.txt");
	int n, m;
	cin>>n>>m;
	while(m--)
	{
		int x, y;
		cin>>x>>y;
		A[x][y] = 1;
		A[y][x] = 1;
	}

	DFS(1);
	if(result==true && s1.size()==n && Pos!=More)
	{
		cout<<"FHTAGN!"<<endl;
		return 0;
	}
	cout<<"NO"<<endl;
	return 0;
}


#include <iostream>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <map>
#include <stdlib.h>
#include <ctime>
//#include <fstream>
using namespace std;

using namespace std;

#define INF 1000000000
#define PI acos(-1.0)
#define MP make_pair
double EPS=1e-8;
#define mod 1000000007

vector<int>g[100];

bool u[100];

void dfs0(int x){
    u[x]=1;
    for (int i=0; i<g[x].size(); i++){
        if (!u[g[x][i]]) dfs0(g[x][i]);
    }
}

pair<vector<int>,int> dfs1(int x,int p=-1){
    u[x]=1;
    for (int i=0; i<g[x].size(); i++){
        if (g[x][i]==p) continue;
        if (u[g[x][i]]){
            vector<int>res;
            res.push_back(x);
            return MP(res,g[x][i]);
        }
        else{
            pair<vector<int>,int> A=dfs1(g[x][i],x);
            vector<int> a=A.first;
            int b=A.second;

            if (b==-2) continue;

            if (b==-1) return MP(a,-1);
            if (b==x) b=-1;;

            a.push_back(x);
            return MP(a,b);

        }
    }

    return MP(vector<int>(0),-2);
}

int NO(){
    cout<<"NO"<<endl;
    return 0;
}

bool uu[100];

bool dfs2(int x,int p=-1){
    u[x]=1;
    for (int i=0; i<g[x].size(); i++){
        if (g[x][i]==p) continue;
        if (uu[g[x][i]]) continue;
        if (u[g[x][i]]) return 0;
        if (dfs2(g[x][i],x)==0) return 0;

    }

    return 1;
}

int main(){

    int n,m;
    cin>>n>>m;

    for (int i=0; i<m; i++){
        int x,y;
        cin>>x>>y;

        x--;
        y--;

        g[x].push_back(y);
        g[y].push_back(x);
    }

    dfs0(0);

    for (int i=0; i<n; i++){
        if (!u[i]) return NO();
        u[i]=0;
    }

    pair<vector<int>,int>A=dfs1(0);

/*  for (int i=0; i<n; i++){
        if (!u[i]) return NO();
    }*/

    if (A.second==-2) return NO();

    vector<int>a=A.first;
    if (a.size()<3) return NO();

    for (int i=0; i<n; i++){
        u[i]=0;
        uu[i]=0;
    }

    for (int i=0; i<a.size(); i++){
        u[a[i]]=uu[a[i]]=1;
    }

    for (int i=0; i<a.size(); i++){
        if (dfs2(a[i])==0) return NO();
    }

    cout<<"FHTAGN!"<<endl;

    return 0;
}


#include <iostream>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <map>
#include <stdlib.h>
#include <ctime>
//#include <fstream>
using namespace std;

using namespace std;

#define INF 1000000000
#define PI acos(-1.0)
#define MP make_pair
double EPS=1e-8;
#define mod 1000000007

vector<int>g[100];

bool u[100];

pair<vector<int>,int> dfs1(int x,int p=-1){
    u[x]=1;
    for (int i=0; i<g[x].size(); i++){
        if (g[x][i]==p) continue;
        if (u[g[x][i]]){
            vector<int>res;
            res.push_back(x);
            return MP(res,g[x][i]);
        }
        else{
            pair<vector<int>,int> A=dfs1(g[x][i],x);
            vector<int> a=A.first;
            int b=A.second;

            if (b==-2) continue;

            if (b==-1) return MP(a,-1);
            if (b==x) b=-1;;

            a.push_back(x);
            return MP(a,b);

        }
    }

    return MP(vector<int>(0),-2);
}

int NO(){
    cout<<"NO"<<endl;
    return 0;
}

bool uu[100];

bool dfs2(int x,int p=-1){
    u[x]=1;
    for (int i=0; i<g[x].size(); i++){
        if (g[x][i]==p) continue;
        if (uu[g[x][i]]) continue;
        if (u[g[x][i]]) return 0;
        if (dfs2(g[x][i],x)==0) return 0;

    }

    return 1;
}

int main(){

    int n,m;
    cin>>n>>m;

    for (int i=0; i<m; i++){
        int x,y;
        cin>>x>>y;

        x--;
        y--;

        g[x].push_back(y);
        g[y].push_back(x);
    }

    pair<vector<int>,int>A=dfs1(0);

    for (int i=0; i<n; i++){
        if (!u[i]) return NO();
    }

    if (A.second==-2) return NO();

    vector<int>a=A.first;
    if (a.size()<3) return NO();

    for (int i=0; i<n; i++){
        u[i]=0;
        uu[i]=0;
    }

    for (int i=0; i<a.size(); i++){
        u[a[i]]=uu[a[i]]=1;
    }

    for (int i=0; i<a.size(); i++){
        if (dfs2(a[i])==0) return NO();
    }

    cout<<"FHTAGN!"<<endl;

    return 0;
}


#include<stdio.h>
#include<memory.h>
int graph[101][101];
int color[101];//0-white,1-grey,2-blackl
int n,m;
int count;
int dfs(int i,int from)
{
 color[i]=1;
 for(int j=0;j<n;j++)
 {
     if(graph[i][j]==1 && j!=i)
     {
         if(j!=from)
         {
             if(color[j]==1)
             {
             count++;
             }
             if(color[j]==0)
             {
                 dfs(j,i);
             }
         }
     }
 }
 color[i]=2;
 return 0;
}
int main()
{
    count=0;
    memset(graph,0,sizeof(graph));
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int from,to;
        scanf("%d %d",&from,&to);
        from--;
        to--;
        graph[from][to]=1;
        graph[to][from]=1;

    }
    dfs(0,-1);
    bool allc=true;
    for(int i=0;i<n;i++)
    {
        if(color[i]!=2)allc=false;
    }
    if(allc && count==1)
    {
        printf("FHTAGN!\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;

}


#include<stdio.h>
#include<memory.h>
int graph[101][101];
int color[101];//0-white,1-grey,2-blackl
int n,m;
bool found;
int dfs(int i,int from)
{
 color[i]=1;
 for(int j=0;j<n;j++)
 {
     if(graph[i][j]==1 && j!=i)
     {
         if(j!=from)
         {
             if(color[j]==1)
             {
             found=true;
             }
             if(color[j]==0)
             {
                 dfs(j,i);
             }
         }
     }
 }
 color[i]=2;
 return 0;
}
int main()
{
    found=false;
    memset(graph,0,sizeof(graph));
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int from,to;
        scanf("%d %d",&from,&to);
        from--;
        to--;
        graph[from][to]=1;
        graph[to][from]=1;

    }
    dfs(0,-1);
    bool allc=true;
    for(int i=0;i<n;i++)
    {
        if(color[i]!=2)allc=false;
    }
    if(allc && found)
    {
        printf("FHTAGN!\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;

}


#include<stdio.h>
#include<memory.h>
int graph[101][101];
int color[101];//0-white,1-grey,2-blackl
int n,m;
bool found;
int dfs(int i,int from)
{
 color[i]=1;
 for(int j=0;j<n;j++)
 {
     if(graph[i][j]==1)
     {
         if(j!=from)
         {
             if(color[j]==1)
             {
             found=true;
             }
             if(color[j]==0)
             {
                 dfs(j,i);
             }
         }
     }
 }
 color[i]=2;
 return 0;
}
int main()
{
    found=false;
    memset(graph,0,sizeof(graph));
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int from,to;
        scanf("%d %d",&from,&to);
        from--;
        to--;
        graph[from][to]=1;
        graph[to][from]=1;

    }
    dfs(0,-1);
    bool allc=true;
    for(int i=0;i<n;i++)
    {
        if(color[i]!=2)allc=false;
    }
    if(allc && found)
    {
        printf("FHTAGN!\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;

}


	#include <iostream>
	using namespace std;

	#define MAX 105

	// father[x]��ʾx�ĸ��ڵ�
	int father[MAX];
	// rank[x]��ʾx����
	int rank[MAX];

	// ��ʼ��
	void Make_Set(int n)
	{
	    for(int i=1; i<=n; ++i)
	    {
	        father[i] = i;
	        rank[i] = 1;
	    }
	}

	// ����
	int Find_Set(int x)
	{
	    if(x != father[x])
	        return Find_Set(father[x]);
	    return x;
	}

	// �ϲ�
	bool Union(int x, int y)
	{
	    x = Find_Set(x);
	    y = Find_Set(y);
	    if(x == y)  // x,y��ͬһ������
	        return false;
	    if(rank[x] > rank[y])
	    {
	        father[y] = x;
	        rank[x] += rank[y];
	    }
	    else if(rank[x] < rank[y])
	    {
	        father[x] = y;
	        rank[y] += rank[x];
	    }
	    else
	    {
	        father[x] = y;
	        rank[y] += rank[x];
	    }
		return true;
	}

	int main()
	{
		int n;
		int m;
		int mm;
		int a,b;
		bool flag;
		bool flag1;
		while(scanf("%d%d",&n,&m)!=EOF)
		{
			flag = true;
			mm = 0;
			Make_Set(n);
			for(int i = 1;i<=m;i++)
			{
				scanf("%d%d",&a,&b);
				flag1 = Union(a,b);
				if(!flag1)
				{
					flag = false;
				}
			}
			for(int j = 1;j<=n;j++)
			{
				if(father[j]==j)
				{
					mm++;
				}
			}
			if(mm>1)
				flag = true;
			if(!flag)
			{
				printf("FHTAGN!\n");
			}
			else
			{
				printf("NO\n");
			}
		}
		return 0;
	}


#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
typedef long long int ll;
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

const ll mod = 1e9+7;
const double eps = 1e-9;

//5
//xYyXzZaZ

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    map<char,int>keys;
    int ans=0;
    for(int i=0;i<(int)s.size();i+=2) {
        char cur = s[i] & '_';
        if(cur == s[i+1]) {
            continue;
        }
        else {
            keys[s[i]]++;
            char key = s[i+1] | ' ';
            debug(cur,key);
            if(keys[key]==0) {
                ans ++;
            }
            else {
                keys[key]--;
            }
        }
    }
    cout<<ans<<"\n";
}

int main(){
    fastio
    int test=1;
    while(test--)
        solve();
    return 0;
}


#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
typedef long long int ll;
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

const ll mod = 1e9+7;
const double eps = 1e-9;

//5
//xYyXzZaZ

const int maxN = 26;

int cnt[maxN];

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<(int)s.size();i+=2) {
        char cur = s[i] & '_';
        if(cur == s[i+1]) {
            continue;
        }
        else {
            cnt[s[i]-'a']++;
            char key = s[i+1] | ' ';
            debug(cur,key);
            if(cnt[key-'a']==0) {
                ans ++;
            }
            else {
                cnt[key-'a']--;
            }
        }
    }
    cout<<ans;
}

int main(){
    fastio
    int test=1;
    while(test--)
        solve();
    return 0;
}


#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
typedef long long int ll;
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

const ll mod = 1e9+7;
const double eps = 1e-9;

//5
//xYyXzZaZ

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    unordered_map<char,int>keys;
    int ans=0;
    for(int i=0;i<(int)s.size();i+=2) {
        char cur = s[i] & '_';
        if(cur == s[i+1]) {
            continue;
        }
        else {
            keys[s[i]]++;
            char key = s[i+1] | ' ';
            debug(cur,key);
            if(keys[key]==0) {
                ans ++;
            }
            else {
                keys[key]--;
            }
        }
    }
    cout<<ans<<"\n";
}

int main(){
    fastio
    int test=1;
    while(test--)
        solve();
    return 0;
}


#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
typedef long long int ll;
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

const ll mod = 1e9+7;
const double eps = 1e-9;

//5
//xYyXzZaZ

const int maxN = 26;

int cnt[maxN];

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<(int)s.size();i+=2) {
        char cur = s[i] & '_';
        if(cur == s[i+1]) {
            continue;
        }
        else {
            cnt[s[i]-'a']++;
            char key = s[i+1] | ' ';
            if(cnt[key-'a']==0) {
                ans ++;
            }
            else {
                cnt[key-'a']--;
            }
        }
    }
    cout<<ans;
}

int main(){
    fastio
    int test=1;
    while(test--)
        solve();
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int findKeys(string s,int n){
    n=2*n-2;
    int a[26]={0};
    int keys=0;
    for(int i=0;i<n;i++){
        if(i&1){
            if(a[s[i]-'A']>0){
                a[s[i]-'A']--;
            }else keys++;
        }else{
            a[s[i]-'a']++;
        }
    }
    return keys;
}
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    cout<<findKeys(s,n);
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int findKeys(String s,int n){
    n=2*n-2;
    int a[26]={0};
    keys=0;
    for(int i=0;i<n;i++){
        if(i&1){
            if(a[s[i]-'A']>0){
                a[s[i]-'A']--;
            }else keys++;
        }else{
            a[s[i]-'a']++;
        }
    }
    return keys;
}
int main(){
    int n;
    cin>>n;
    String s;
    cin>>s;
    cout<<findKeys(s,n);
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<String>
using namespace std;
int findKeys(String s,int n){
    n=2*n-2;
    int a[26]={0};
    keys=0;
    for(int i=0;i<n;i++){
        if(i&1){
            if(a[s[i]-'A']>0){
                a[s[i]-'A']--;
            }else keys++;
        }else{
            a[s[i]-'a']++;
        }
    }
    return keys;
}
int main(){
    int n;
    cin>>n;
    String s;
    cin>>s;
    cout<<findKeys(s,n);
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int findKeys(string s,int n){
    n=2*n-2;
    int a[26]={0};
    keys=0;
    for(int i=0;i<n;i++){
        if(i&1){
            if(a[s[i]-'A']>0){
                a[s[i]-'A']--;
            }else keys++;
        }else{
            a[s[i]-'a']++;
        }
    }
    return keys;
}
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    cout<<findKeys(s,n);
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int findKeys(String s,int n){
    n=2*n-2;
    int a[26]={0};
    keys=0;
    for(int i=0;i<n;i++){
        if(i&1){
            if(a[s[i]-'A']>0){
                a[s[i]-'A']--;
            }else keys++;
        }else{
            a[s[i]-'a']++;
        }
    }
    return keys;
}
int main(){
    int n;
    cin>>n;
    String s;
    cin>>s;
    cout<<findKeys(s,n);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define NN 210000
char str[NN];
int pat[30];
int main(){
#ifndef ONLINE_JUDGE
	freopen("A.in", "r", stdin);
	freopen("test.out", "w", stdout);
#endif
	int n; scanf("%d", &n);
	scanf("%s", str);
	int ans = 0;
	for(int i = 0; i < strlen(str); i += 2){
		pat[str[i] - 'a']++;
		int id = str[i + 1] - 'A';
		if(pat[id] > 0) pat[id]--;
		else ans++;
	}
	printf("%d\n", ans);
}


#include <bits/stdc++.h>
using namespace std;
#define NN 210000
char str[NN];
int pat[30];
int main(){
#ifndef ONLINE_JUDGE
	freopen("A.in", "r", stdin);
	freopen("test.out", "w", stdout);
#endif
	int n; scanf("%d", &n);
	scanf("%s", str);
	int m = strlen(str);
	int ans = 0;
	for(int i = 0; i < m; i += 2){
		pat[str[i] - 'a']++;
		int id = str[i + 1] - 'A';
		if(pat[id] > 0) pat[id]--;
		else ans++;
	}
	printf("%d\n", ans);
}


#include <bits/stdc++.h>

using namespace std;

const int NN=201010;

int key[30];
char s[NN];

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
#endif
	int n; cin>>n;
	cin>>s;
	int ans=0;

	for(int i=0;i<2*n-2;i++){
		if(i%2==0)key[s[i]-'a']++;
		else {
			if(key[s[i]-'A'])key[s[i]-'A']--;
			else ans++;
		}
	}
	cout<<ans<<endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define scan(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define scan1(a,n) for(int i=0;i<n;i++){  int z; cin>>z; a.pb(z);}
#define for1(i,n) for(int i=0;i<n;i++)
int main() {
        int n;
        cin>>n;
        string s;
        cin>>s;
        for(int i=1;i<2*n-2;i+=2)
        {
        	for(int j=0;j<i;j+=2)
        	{
        		if(s[i]==s[j]-32)
        		{
        			s[j]='@';
        			//cout<<s<<endl;
				}
			}
		}
		int c=0;
		for(int i=0;i<2*n-2;i+=2)
		{
			if(s[i]>='a'&&s[i]<='z')
			c++;
		}
		cout<<c<<endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define scan(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define scan1(a,n) for(int i=0;i<n;i++){  int z; cin>>z; a.pb(z);}
#define print(a) for(int i=0;i<a.size();i++){    cout<<a[i]<<" " ;}
#define for1(i,n) for(int i=0;i<n;i++)
int main() {
        int n,c=0;
         cin>>n;
         string s;
         cin>>s;
         set<int> a;
         for(int i=0;i<s.length();i++)
         {
         	if(i%2==0)
         	{
         		a.insert((int)s[i]);
			 }
			 else
			 {   int q=(int)s[i] +32;
			 	if(binary_search(a.begin(),a.end(),q))
			 	{
			 		set<int> ::iterator it=find(a.begin(),a.end(),q);
					 a.erase(it);
				 }
				 else
				 c++;

			 }
			 //print(a);

		 }
		 cout<<c<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define scan(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define scan1(a,n) for(int i=0;i<n;i++){  int z; cin>>z; a.pb(z);}
#define print(a) for(int i=0;i<a.size();i++){    cout<<a[i]<<" " ;}
#define for1(i,n) for(int i=0;i<n;i++)
int main() {
        int q=1;
       // cin>>q;
        while(q--)
        {
        	int n,c=0;
         cin>>n;
         string s;
         cin>>s;
         int check[26]={0};
         for(int i=0;i<s.length();i++)
         {
         	if(s[i]>='a')
         	   check[s[i]-97]++;
         	else
         	   {
         	   	if(check[s[i]-65])
         	   	 check[s[i]-65]--;
         	   	 else
         	   	  c++;
				}
		 }
		 cout<<c<<endl;
		}
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define scan(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define scan1(a,n) for(int i=0;i<n;i++){  int z; cin>>z; a.pb(z);}
#define for1(i,n) for(int i=0;i<n;i++)
int main() {
        int n;
        cin>>n;
        string s;
        cin>>s;
        vector<char> p;
	    for(int i=0;i<2*n-2;i++)
	    {
	    	if(i%2==0)
	    	 p.pb(s[i]);
	    	 else
	    	  {
	    	  		char a=s[i]+32;
              	if(binary_search(p.begin(),p.end(),a))
              	 {
              	 	//cout<<'@'<<endl;
              	 	vector<char> :: iterator it=find(p.begin(),p.end(),a);

					 //cout<<p.size()<<endl;
					 	p.erase(it);
			  }
		}
}
    cout<<p.size()<<endl;
      //cout<<"end"<<endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    string x; getline(cin, x);
    int res = 0;
    for (int i = 0; i < i; i += 2){
        if ((x[i] - ('a' - 'A')) == x[i + 1]) ++res;
    }
    cout << res;
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    string x; getline(cin, x);
    int res = 0;
    for (int i = 0; i < i; i += 2){
        if ((x[i] - 'a') == x[i + 1]) ++res;
    }
    cout << res;
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    string x; getline(cin, x);
    int res = 0;
    for (int i = 0; i < i; i += 2){
        if ((x[i] - ('a' - 'A')) != x[i + 1]) ++res;
    }
    cout << res;
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    int n; cin >> n >> ws;
    string x; getline(cin, x);
    int res = 0;
    int arr[26] = {};
    for (int i = 0; i < (int)x.length(); i += 2){
        arr[x[i] - 'a']++;
        if (arr[x[i + 1] - 'A'] != 0) {--arr[x[i + 1] - 'A']; continue;}
        else ++res;
    }
    cout << res;
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    string x; getline(cin, x);
    int res = 0;
    for (int i = 0; i < i; i += 2){
        if ((x[i] - ('A' - 'a')) == x[i + 1]) ++res;
    }
    cout << res;
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    int n; cin >> n >> ws;
    string x; getline(cin, x);
    int res = 0;
    for (int i = 0; i < (int)x.length(); i += 2){
        if ((x[i] - ('a' - 'A')) != x[i + 1]) ++res;
    }
    cout << res;
    return 0;
}


#include<bits/stdc++.h>
#include<sstream>
typedef long long ll;
using namespace std;

int main()
{

	int N;
	cin>>N;
	string S;
	cin>>S;
	ll Ans = 0;
	map<char,int>Keys;
	for(int i=0;i<S.length()-1;i+=2)
	{
		if((char)(S[i]-32) == S[i+1] || Keys[(char)(S[i+1]+32)] > 0)
		{

		}
		else
		{
			Ans++;
			Keys[S[i]]++;
		}
	}
	cout<<Ans;

	return 0 ;

}


#include<bits/stdc++.h>
#include<sstream>
typedef long long ll;
using namespace std;

int main()
{

	int N;
	cin>>N;
	string S;
	cin>>S;
	ll Ans = 0;
	map<char,int>Keys;
	for(int i=0;i<S.length()-1;i+=2)
	{
		if((char)(S[i]-32) == S[i+1])
		{

		}
		else if(Keys[(char)(S[i+1]+32)] > 0)
		{
			Keys[(char)(S[i+1]+32)]--;
		}
		else
		{
			Ans++;
			Keys[S[i]]++;
		}
	}
	cout<<Ans;

	return 0 ;

}


#include<bits/stdc++.h>
#include<sstream>
typedef long long ll;
using namespace std;

int main()
{

	int N;
	cin>>N;
	string S;
	cin>>S;
	ll Ans = 0;
	map<char,int>Keys;
	for(int i=0;i<S.length();i++)
	{
		if((int)S[i] >= 97)
		{
			Keys[S[i]]++;
		}
		else
		{
			if(Keys[(char)(S[i]+32)] > 0)
			{
				Keys[(char)(S[i]+32)]--;
			}
			else
			{
				Ans++;
			}
		}
	}
	cout<<Ans;

	return 0 ;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,cc=0;
    cin>>n;
    string s;
    cin>>s;
    vector<int> V(26,0);
    for(i=0;i<s.length();i+=2)
    {
        int p=s[i],q=s[i+1];
        ++V[p-97];
        if(p-q!=32)
        {
            int c=(q+32)-97;
            if(V[c]==0)
            ++cc;
            else
            --V[c];
        }
        else
        --V[p-97];
    }
    cout<<cc;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,cc=0;
    cin>>n;
    string s;
    cin>>s;
    unordered_set<char> S;
    for(i=0;i<s.length();i+=2)
    {
        int p=s[i],q=s[i+1];
        if(p-q!=32)
        {
            char c=(q+32);
            if(S.count(c)==0)
            ++cc;
            S.insert(s[i]);
        }
    }
    cout<<cc;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,cc=0;
    cin>>n;
    string s;
    cin>>s;
    vector<int> V(26,0);
    for(i=0;i<s.length();i+=2)
    {
        int p=s[i],q=s[i+1];
        if(p-q!=32)
        {
            int c=(q+32)-97;
            if(V[c]==0)
            ++cc;
            else
            --V[c];
            c=p-97;
            ++V[c];
        }
        else
        {
        	if(V[p-97])
        	--V[p-97];
		}
    }
    cout<<cc;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,cc=0;
    cin>>n;
    string s;
    cin>>s;
    vector<bool> V(26,false);
    for(i=0;i<s.length();i+=2)
    {
        int p=s[i],q=s[i+1];
        if(p-q!=32)
        {
            int c=(q+32)-97;
            if(V[c]==false)
            ++cc;
            else
            V[c]=false;
            c=p-97;
            V[c]=true;
        }
        else
        {
        	if(V[p-97])
        	V[p-97]=false;
		}
    }
    cout<<cc;
}


#include <bits/stdc++.h>
using namespace std;
char s[200010];
int k[30];
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	int n,cnt=0;
	cin>>n;
	cin>>s+1;
	for(int i=1;i<=2*n-2;i++){
		if(i%2) k[s[i]-'a']++;
		else {
			if(k[s[i]-'A']) {
				k[s[i]-'A']--;
			}
			else cnt++;
		}
	}
	cout<<cnt<<endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

using INT=long long;
const int NN=202020;

char s[NN];
int a[NN];

main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
#endif
	int n; cin>>n>>s;

	int cnt=0;

	for(int i=0;i<2*n-2;i++){
		if(i&1){
			if(a[s[i]-'A']){
				a[s[i]-'A']--;
				continue;
			}
			cnt++;
			continue;
		}
		a[s[i]-'a']++;
	}
	cout<<cnt<<endl;
}


#include <bits/stdc++.h>
#define NN 200010
using namespace std;
char str[NN];
int cnt[30];
int main(){
	int n;
	scanf("%d", &n);
	cin>>str;
	int cnt1 = 0;
	for(int i = 0; i < 2 * (n - 1); i += 2){
		cnt[str[i] - 'a']++;
		if(cnt[str[i + 1] - 'A'] == 0) cnt1++;
		else cnt[str[i + 1] - 'A']--;
	}
	cout<<cnt1<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define NN 200010

using namespace std;

char s[NN];
int f[30]={0,};
int main() {
#ifndef	ONLINE_JUDGE
	freopen("in.in", "r", stdin);
//	freopen("out.out", "w", stdout);
#endif
	int  n,cnt=0;
	cin>>n;
	scanf("%s",s+1);
	for(int i=1;i<=2*n-2;i++){
		if(i&1)f[s[i]-'a']++;
		else {
			if(f[s[i]-'A'])f[s[i]-'A']--;
			else cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define NN 300010
char s[NN];
int cnt[NN];

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	int n;
	scanf("%d",&n);
	scanf("%s",s+1);
	int ans=0;
	for(int i=1;i<=2*n-2;i++){
		if(i&1){
			int x=s[i]-'a';
			cnt[x]++;
		}
		else{
			int x=s[i]-'A';
			if(!cnt[x]) ans++;
			else cnt[x]--;
		}
	}
	printf("%d\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long INT;
typedef vector<int> VI;
typedef pair<int,int> pii;
char a[100100];
int k[30];
int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n;
	scanf("%d",&n);
	cin>>a+1;
	int ans=0;
	for(int i=1;i<=2*(n-1);i+=2){
		k[a[i]-'a']++;
		if(k[a[i+1]-'A']) k[a[i+1]-'A']--;
		else ans++;
	}
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define NN 210000
using namespace std;
char st[NN];
int a[30];
int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n;
	cin>>n>>st;
	int ans=0;
	for(int i=1;i<2*n-2;i+=2){
		a[st[i-1]-'a']++;
		if(st[i-1]-st[i]==32){
			a[st[i-1]-'a']--;
		}
		else if(a[st[i]-'A']){
			a[st[i]-'A']--;
		}
		else ans++;
	}
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define NN 100010

using namespace std;

char s[NN];
int f[30]={0,};
int main() {
#ifndef	ONLINE_JUDGE
	freopen("in.in", "r", stdin);
//	freopen("out.out", "w", stdout);
#endif
	int  n,cnt=0;
	cin>>n;
	scanf("%s",s+1);
	for(int i=1;i<=2*n-2;i++){
		if(i&1)f[s[i]-'a']++;
		else {
			if(f[s[i]-'A'])f[s[i]-'A']--;
			else cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long INT;
typedef vector<int> VI;
typedef pair<int,int> pii;
char a[200100];
int k[30];
int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n;
	scanf("%d",&n);
	cin>>a+1;
	int ans=0;
	for(int i=1;i<=2*(n-1);i+=2){
		k[a[i]-'a']++;
		if(k[a[i+1]-'A']) k[a[i+1]-'A']--;
		else ans++;
	}
	cout<<ans<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
char s[100010];
int k[30];
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	int n,cnt=0;
	cin>>n;
	cin>>s+1;
	for(int i=1;i<=2*n-2;i++){
		if(i%2) k[s[i]-'a']++;
		else {
			if(k[s[i]-'A']) {
				k[s[i]-'A']--;
			}
			else cnt++;
		}
	}
	cout<<cnt<<endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    long n,k=0;
    string s;
    cin>>n>>s;
    long n2 = s.size();
    for(long i=0;i<n2;i+=2){
        long p = s.find(s[i]-32,i+1);
        if(p < n2 && p > 0)s[p] = '0';
        else k++;
    }
    cout<<k<<endl;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k=0;
    string s;
    cin>>n>>s;
    int n2 = s.size();
    for(int i=0;i<n2;i+=2){
        for(int j=i+1;j<n2;j+=2){
            if(s[i] - 32 == s[j]){
                s[j] == '0';
                break;
            }
            if(j==n2-1){
                k++;
            }
        }
    }
    cout<<k++;

}


#include <bits/stdc++.h>
using namespace std;
int main(){
    long n,k=0;
    string s;
    cin>>n>>s;
    long n2 = s.size();
    for(long i=0;i<n2;i+=2){
        long p = s.find(s[i]-32,i+1);
        if(p < n2 && p > 0)s[p] = '0';
        else {
            for(int j = i;j<n2;j+=2){
                s.replace(i,1,"0");
            }
            k++;
        }
    }
    cout<<k<<endl;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    long n,k=0;
    string s;
    cin>>n>>s;
    long n2 = s.size();
    for(long i=0;i<n2;i+=2){
        for(long j=i+1;j<n2;j+=2){
            if(s[i] - 32 == s[j]){
                s[j] = '0';
                break;
            }
            if(j==n2-1){
                k++;
            }
        }
    }
    cout<<k++<<endl;
    //cout<<n;

}


#include <bits/stdc++.h>
using namespace std;
int main(){
    long n,k=0;
    string s;
    cin>>n>>s;
    long n2 = s.size();
    long alf[26];
    fill(alf,alf+26,0);
    for(long i=0;i<n2;i++){
        if(i%2==0){
            alf[s[i]-97]++;
        }
        else{
            if(alf[s[i]-65]==0)k++;
            else alf[s[i]-65]--;
        }
    }
    //for(int a = 0;a<26;a++)cout<<alf[a];
    cout<<k<<endl;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
	int N;
	string D;
	cin >> N >> D;
	int Count = 0;

	for (int i = 1;i < D.size();i+=2)
	{
		for (int j = i - 1;j >= 0;j -= 2)
		{
			if ((int)D[i] == (int)(D[j] - 32))
			{
				D.erase(D.begin() + j);
				i--;
				j--;
				break;
			}
			else if(j == 0)
				Count++;
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	map<char, int> m;
	m.clear();
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			m[D[i]]++;
		}
		else
		{
			if (m[(char)((int)D[i]+32)] != 0)
			{
				m[D[i]]--;
				break;
			}
			else
				Count++;

		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	map<char, int> m;
	m.clear();
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			m[D[i]]++;
		}
		else
		{
			if (m[D[i]]!=0)
			{
				m[D[i]]--;
				break;
			}
			else
				Count++;

		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	map<int, char> S;
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size()-1;i+=2)
	{
		S[i] = D[i];
	}
	for (int i = 1;i < D.size();i+=2)
	{
		for (int j = i-1; j>=0;j--)
		{
			if ((int)D[i] == (int)((S[j] - 32)))
			{
				S.erase(j);
				break;
			}
			else if(j == 0)
				Count++;
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	string S;
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			S.push_back(D[i]);
		}
		else
		{
			for (int j = S.size();j >= 0 ;j--)
			{
				if ((int)D[i] == (int)((S[j] - 32)))
				{
					S.erase(j);
					break;
				}
				else if (j == 0)
					Count++;
			}
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
	int N;
	string D;
	cin >> N >> D;
	int Count = 0;
	for (int i = 1;i < D.size();i+=2)
	{
		for (int j = i - 1;j >= 0;j -= 2)
		{
			if ((int)D[i] == (int)(D[j] - 32))
			{
				D[j] = '*';
				break;
			}
			else if(j == 0)
				Count++;
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
	int N;
	string D;
	cin >> N >> D;
	int Count = 0;

	for (int i = 1;i < D.size();i+=2)
	{
		for (int j = i - 1;j >= 0;j -= 2)
		{
			if ((int)D[i] == (int)(D[j] - 32))
			{
				D.erase(D.begin() + i);
				i--;
				j--;
				break;
			}
			else if(j == 0)
				Count++;
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	map<char, int> m;
	m.clear();
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			m[D[i]]++;
		}
		else
		{
			if (m[(char)((int)D[i]+32)] != 0)
			{
				m[(char)((int)D[i] + 32)]--;
			}
			else
				Count++;
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
	int N;
	string D;
	string S;
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size()-1;i+=2)
	{
		S.push_back(D[i]);
	}
	for (int i = 1;i < D.size();i+=2)
	{
		for (int j = 0;j <S.size();j++)
		{
			if ((int)D[i] == (int)(S[j] - 32))
			{
				S.erase(S.begin() + j);
				break;
			}
			else if(j == 0)
				Count++;
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	map<char, int> m;
	m.clear();
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			m[D[i]]++;
		}
		else
		{
			if (m[(char)((int)D[i]+32)] != 0)
			{
				m[(char)((int)D[i] + 32)]--;
				break;
			}
			else
				Count++;

		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	string S;
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			S.push_back(D[i]);
		}
		else
		{
			for (int j = S.size()-1;j >= 0 ;j--)
			{
				if ((int)D[i] == (int)((S[j] - 32)))
				{
					S.erase(j);
					break;
				}
				else if (j == 0)
					Count++;
			}
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	string S;
	int k = 0;
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			S[k] = D[i];
			k++;
		}
		else
		{
			for (int j = S.size()-1;j >= 0 ;j--)
			{
				if ((int)D[i] == (int)((S[j] - 32)))
				{
					S.erase(j);
					k--;
					break;
				}
				else if (j == 0)
					Count++;
			}
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	string S;
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			S.push_back(D[i]);
		}
		else
		{
			for (int j = S.size()-1;j >= 0 ;j--)
			{
				if ((int)D[i] == (int)((S[j] - 32)))
				{
					S.erase(S.begin()+j);
					break;
				}
				else if (j == 0)
					Count++;
			}
		}
	}
	cout << Count << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main()
{
	int N;
	string D;
	string S;
	cin >> N >> D;
	int Count = 0;
	for (int i = 0;i < D.size();i++)
	{
		if (i % 2 == 0)
		{
			S.push_back(D[i]);
		}
		else
		{
			if(D[i] == D[i-2])
			{
				if ((int)D[i] == (int)((D[i-1] - 32)))
				{
					S.pop_back();
					break;
				}
				else
					Count++;
			}
			else
			{
				for (int j = S.size() - 1;j >= 0;j--)
				{
					if ((int)D[i] == (int)((S[j] - 32)))
					{
						S.erase(S.begin() + j);
						break;
					}
					else if (j == 0)
						Count++;
				}
			}
		}
	}
	cout << Count << endl;
}


#include <bits/stdc++.h>
using namespace std;

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);

	map<char, int> m;
	int n,count = 0;
	string s;
	cin >> n >> s;

    for (int i = 0; i < 2*n - 3; i += 2)
    {
    	if(s[i] - s[i+1] == 32) // present do nothing
    		continue;
    	else if(m[s[i+1] + 32] >= 1) // check from prev visits
    	{
    		m[s[i]]--;
    	}
    	else //buy
    	{
           count++;
           m[s[i]]++;
    	}
    }
    cout << count << "\n";
return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);

	map<char, int> m;
	int n,count = 0;
	string s;
	cin >> n >> s;

    for (int i = 0; i < 2*n - 3; i += 2)
    {
    	if(s[i] - s[i+1] == 32) // present do nothing
    		continue;
    	else if(m[s[i+1] + 32] >= 1) // check from prev visits
    	{
    		m[s[i+1] + 32]--;
    	}
    	else //buy
    	{
           count++;
           m[s[i]]++;
    	}
    }
    cout << count << "\n";
return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);

	map<char, int> m;
	int n,count = 0;
	string s;
	cin >> n >> s;

    for (int i = 0; i < 2*n - 3; i += 2)
    {
    	if(s[i] - s[i+1] == 32) // present do nothing
    		continue;
    	else if(m[s[i+1] + 32] >= 1) // check from prev visits
    	{
    		m[s[i+1] + 32] -= 1;
    	}
    	else //buy
    	{
           count += 1;
           m[s[i]] += 1;
    	}
    }
    cout << count << "\n";
return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);

	map<char, int> m;
	int n,count = 0;
	string s;
	cin >> n >> s;

    for (int i = 0; i < 2*n - 2; i++)
    {
    	if(s[i] >= 97 && s[i] <= 122)  // lower case
    		m[s[i]]++;
    	else if(s[i] >= 65 && s[i] <= 90 && m[s[i] + 32] > 0) // upper case
    	{
    	   m[s[i] + 32]--;
    	}
    	else //buy
    	{
           count++;
        }
    }
    cout << count << "\n";
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int h[27];
main()
{
int n,i,r;
char a,b;
cin>>n;
for(i=0;i<n-1;i++)
{cin>>a>>b;
h[a-97]++;
if(h[b-65]==0)
{
r++;}
else m[b-65]--;
}


#include<bits/stdc++.h>
using namespace std;
int h[99];
main()
{
int n,i,r=0;
char a,b;
cin>>n;
for(i=0;i<n-1;i++)
{cin>>a>>b;
h[a-97]++;
if(h[b-65]==0)
{
r++;}
else h[b-65]--;
}
cout<<r;
}


#include<bits/stdc++.h>
using namespace std;
main()
{
int n,i,r,h[99]={0};
char a,b;
cin>>n;
for(i=0;i<n-1;i++)
{cin>>a>>b;
h[a-97]++;
if(h[b-65]==0)
{
r++;}
else h[b-65]--;
}
cout<<r;
}


#include<bits/stdc++.h>
using namespace std;
main()
{
int n,i,r=0,h[99]={0};
char a,b;
cin>>n;
for(i=0;i<n-1;i++)
{cin>>a>>b;
h[a-97]++;
if(h[b-65]==0)
{
r++;}
else h[b-65]--;
}
cout<<r;
}


#include<bits/stdc++.h>
using namespace std;
int h[27];
main()
{
int n,i,r;
char a,b;
cin>>n;
for(i=0;i<n-1;i++)
{cin>>a>>b;
h[a-97]++;
if(h[b-65]==0)
{
r++;}
else m[b-65]--;
}
}


#include<bits/stdc++.h>
using namespace std;
int r;
int h[99];
main()
{
int n,i;
char a,b;
cin>>n;
for(i=0;i<n-1;i++)
{cin>>a>>b;
h[a-97]++;
if(h[b-65]==0)
{
r++;}
else h[b-65]--;
}
cout<<r;
}


#include<bits/stdc++.h>
using namespace std;
int h[27];
main()
{
int n,i,r;
char a,b;
cin>>n;
for(i=0;i<n-1;i++)
{cin>>a>>b;
h[a-97]++;
if(h[b-65]==0)
{
r++;}
else h[b-65]--;
}
cout<<r;
}


#include<bits/stdc++.h>
using namespace std;
int h[27];
main()
{
int n,i,r;
char a,b;
cin>>n;
for(i=0;i<n-1;i++)
{cin>>a>>b;
h[a-97]++;
if(h[b-65]==0)
{
r++;}
else h[b-65]--;
}
}


#include<bits/stdc++.h>
#define long long int ll
using namespace std;
int main(void)
{
     ll n;
     scanf("%d",&n);
     ll l=2*n-2;
     int hash[27];
     ll count=0;
     memset(hash,0,sizeof(hash));
     string st;
     cin>>st;
     for(int i=0;i<l;i++)
     {
          char c=st[i];
          if(i%2==1)
          {
               int index=c-96;
               //ASCII CODE FOR 'a' IS 97
               //ASCII CODE FOR 'A' IS 65
               hash[index]++;
          }
          else
          {
               int index=c-65;
               if(hash[index]!=0)
                    hash[index]--;
               else
                    count++;
          }
     }
     printf("%lld",count);
     return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define long long ll

int main(void)
{
     ll n;
     scanf("%d",&n);
     ll l=2*n-2;
     int hash[27];
     ll count=0;
     memset(hash,0,sizeof(hash));
     string st;
     cin>>st;
     for(int i=0;i<l;i++)
     {
          char c=st[i];
          if(i%2==1)
          {
               int index=c-96;
               //ASCII CODE FOR 'a' IS 97
               //ASCII CODE FOR 'A' IS 65
               hash[index]++;
          }
          else
          {
               int index=c-65;
               if(hash[index]!=0)
                    hash[index]--;
               else
                    count++;
          }
     }
     printf("%lld",count);
     return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(void)
{
     long long int n;
     scanf("%d",&n);
     long long int l;
     int hash[27];
     long long int count=0;
     memset(hash,0,sizeof(hash));
     string st;
     cin>>st;
     l=st.length();
     for(int i=0;i<l;i++)
     {
          char c=st[i];
          //printf("character is %c\n",c);
          if(i%2==0)
          {
               int index=c-97;
               //printf("index on %d is %d.\n",i,index);
               //ASCII CODE FOR 'a' IS 97
               //ASCII CODE FOR 'A' IS 65
               hash[index]+=1;
          }
          else
          {
               int index=c-65;
               //printf("index on %d is %d.\n",i,index);
               if(hash[index]>0)
                    hash[index]--;
               else
                    count++;
          }
     }
     //for(int i=0;i<27;i++)
     {
     	//printf("hash table index=%d value=%d\n",i,hash[i]);
	 }
     printf("%lld",count);
     return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(void)
{
     long long int n;
     scanf("%d",&n);
     long long int l=2*n-2;
     int hash[27];
     long long int count=0;
     memset(hash,0,sizeof(hash));
     string st;
     cin>>st;
     for(int i=0;i<l;i++)
     {
          char c=st[i];
          if(i%2==1)
          {
               int index=c-96;
               //ASCII CODE FOR 'a' IS 97
               //ASCII CODE FOR 'A' IS 65
               hash[index]++;
          }
          else
          {
               int index=c-65;
               if(hash[index]!=0)
                    hash[index]--;
               else
                    count++;
          }
     }
     printf("%lld",count);
     return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define long long int ll

int main(void)
{
     ll n;
     scanf("%d",&n);
     ll l=2*n-2;
     int hash[27];
     ll count=0;
     memset(hash,0,sizeof(hash));
     string st;
     cin>>st;
     for(int i=0;i<l;i++)
     {
          char c=st[i];
          if(i%2==1)
          {
               int index=c-96;
               //ASCII CODE FOR 'a' IS 97
               //ASCII CODE FOR 'A' IS 65
               hash[index]++;
          }
          else
          {
               int index=c-65;
               if(hash[index]!=0)
                    hash[index]--;
               else
                    count++;
          }
     }
     printf("%lld",count);
     return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define omar ios_base::sync_with_stdio(0);ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const double pi=acos(-1);
ll arr[27]= {0};
int main()
{
    omar;
    ll n,cunt=0;
    string s;
    cin>>n>>s;
    for (int i=0; i<2*n-2; i+=2)
    {
        if (s[i]-'a'!=s[i+1]-'A'&&arr[s[i+1]-'A']<=0)
            arr[s[i]-'a']++,cunt++;
        else if (s[i]-'a'!=s[i+1]-'A'&&arr[s[i+1]-'A']>0)
            arr[s[i+1]-'A']--;
    }
    cout<<cunt<<"\n";
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
#define FAST ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define rw freopen("output.txt","w",stdout);
#define mod 998244353
#define F first
#define S second
#define f(x) return cout << x << "\n", 0
#define lp(i,a,x) for (int i=a;i<=x;++i)
#define lp2(i,x,a) for (int i=x;i>=a;--i)
#define all(x) x.begin(),x.end()
using namespace std;
const int N=1e5+5;
multiset<char>st;
int main()
{
    FAST
    int n,cnt=0;
    cin>>n;
    for (int i=0; i<2*n-2; ++i)
    {
        char ch;
        cin>>ch;
        if (islower(ch))
            st.insert(ch-'a');
        else
        {
            int c=ch-'A';
            if (st.count(c))
                st.erase(st.find(c));
            else
                cnt++;
        }
    }
    cout<<cnt;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define omar ios_base::sync_with_stdio(0);ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const double pi=acos(-1);
int arr[27]= {0};
int main()
{
    omar;
    int n,cunt=0;
    string s;
    cin>>n>>s;
    for (int i=0; i<2*n-2; i+=2)
    {
        if (s[i]-'a'!=s[i+1]-'A'&&!arr[s[i+1]-'A'])
            arr[s[i]-'a']++,cunt++;
        else if (s[i]-'a'!=s[i+1]-'A'&&arr[s[i+1]-'A'])
            arr[s[i+1]-'A']--;
    }
    cout<<cunt<<"\n";
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
#define FAST ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define rw freopen("output.txt","w",stdout);
#define mod 998244353
#define F first
#define S second
#define f(x) return cout << x << "\n", 0
#define lp(i,a,x) for (int i=a;i<=x;++i)
#define lp2(i,x,a) for (int i=x;i>=a;--i)
#define all(x) x.begin(),x.end()
using namespace std;
const int N=1e5+5;
unordered_multiset<char>st;
int main()
{
    FAST
    int n,cnt=0;
    cin>>n;
    for (int i=0; i<2*n-2; ++i)
    {
        char ch;
        cin>>ch;
        if (islower(ch))
            st.insert(ch-'a');
        else
        {
            int c=ch-'A';
            if (st.count(c))
                st.erase(st.find(c));
            else
                cnt++;
        }
    }
    cout<<cnt;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define omar ios_base::sync_with_stdio(0);ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const double pi=acos(-1);
ll arr[30]= {};
string s;
ll n,cunt=0;
int main()
{
    omar;
    memset(arr,0,sizeof(arr));
    cin>>n;
    cin>>s;
    for (ll i=0; i<s.size(); i+=2)
    {
        int a=s[i]-'a',b=s[i+1]-'A';
        if (a!=b&&!arr[b])
            arr[a]++,cunt++;
        else if (a!=b&&arr[b]>0)
            arr[b]--,arr[a]++;
    }
    cout<<cunt<<"\n";
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define omar ios_base::sync_with_stdio(0);ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const double pi=acos(-1);
int arr[26]= {0};
int main()
{
    omar;
    int n,cunt=0;
    memset(arr,0,sizeof(arr));
    string s;
    cin>>n>>s;
    for (int i=0; i<2*n-2; i+=2)
    {
        if (s[i]-'a'!=s[i+1]-'A'&&!arr[s[i+1]-'A'])
            arr[s[i]-'a']++,cunt++;
        else if (s[i]-'a'!=s[i+1]-'A'&&arr[s[i+1]-'A']>0)
            arr[s[i+1]-'A']--;
    }
    cout<<cunt<<"\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int n, lc[122]={0}, c=0;
	char s[200000];
	scanf("%lld", &n);
	scanf("%s", s);
	for(long long int i=0; i<2*(n-1); ++i)
	{
		int x= (int)s[i];
		if(i%2==0)
			lc[x]+=1;
		else
		{
			if(lc[x+32]>0)
				lc[x+32]-=1;
			else
				c+=1;
		}
	}
	printf("%lld", c);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int n, lc[26], c=0;
	char s[200000];
	scanf("%lld", &n);
	scanf("%s", s);
	long long int l;
	l=strlen(s);
	for(long long int i=0; i<l; ++i)
	{
		int x= (int)s[i];
		if(i%2==0)
			lc[x]+=1;
		else
		{
			if(lc[x+32]>0)
				lc[x+32]-=1;
			else
				c+=1;
		}
	}
	printf("%lld", c);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int n, lc[123]={0}, c=0;
	char s[200000];
	scanf("%lld", &n);
	scanf("%s", s);
	for(long long int i=0; i<2*(n-1); ++i)
	{
		int x= (int)s[i];
		if(i%2==0)
			lc[x]+=1;
		else
		{
			if(lc[x+32]>0)
				lc[x+32]-=1;
			else
				c+=1;
		}
	}
	printf("%lld", c);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int n, lc[26], c=0;
	char s[200000];
	scanf("%lld", &n);
	scanf("%s", s);
	for(long long int i=0; i<2*(n-1); ++i)
	{
		int x= (int)s[i];
		if(i%2==0)
			lc[x]+=1;
		else
		{
			if(lc[x+32]>0)
				lc[x+32]-=1;
			else
				c+=1;
		}
	}
	printf("%lld", c);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[26];
int main(){
 int n,count(0);
 cin>>n;
 string s;
 cin>>s;
 for(int i=0 ; i<2*n-3; i+=2){
    a[s[i]-'a']++;
    if(a[s[i+1]-'A']){
        a[s[i+1]-'A']--;
    }else{
      count++;
    }
 }
 cout<<count;
}


/*     !ya khoda!     */
#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pp push
#define po pop()
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()

#define F first
#define S second
#define mkp make_pair
#define pll pair<ll,ll>

#define poow(a,b,M)   b?(poow((a*a)%M,b/2)%M * (b&1?a))%M:1 ;

#define IOS ios_base::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
#define coutashar(x,d)   cerr<<fixed<<setprecision(x)<<(ld)d
#define coutghat(x)      cout<<tolower(x);
/*==========================================================================*/
using namespace std;
/*==========================================================================*/
const ll N=2e5+100;
ll n,ans , a,b;
string s;
bool vis[N];
/*==========================================================================*/
int main()
{
    IOS;

    cin>>n>>s;   n=s.size();
    for(int i=0;i<n-1;i+=2)
    {
        a=s[i]-'a' , b=s[i+1]-'A';
        if(a!=b)
        {
            vis[a]=1;
            if(vis[b]==0)
                ans++;
            if(vis[b]==1)
                vis[b]=0;
        }
    }

    cout<<ans;
	return 0;
}


/*     !ya khoda!     */
#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pp push
#define po pop()
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()

#define F first
#define S second
#define mkp make_pair
#define pll pair<ll,ll>

#define poow(a,b,M)   b?(poow((a*a)%M,b/2)%M * (b&1?a))%M:1 ;

#define IOS ios_base::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
#define coutashar(x,d)   cerr<<fixed<<setprecision(x)<<(ld)d
#define coutghat(x)      cout<<tolower(x);
/*==========================================================================*/
using namespace std;
/*==========================================================================*/
const ll N=2e5+100;
ll n,ans , a,b,vis[N];
string s;
/*==========================================================================*/
int main()
{
    IOS;

    cin>>n>>s;   n=s.size();
    for(int i=0;i<n-1;i+=2)
    {
        a=s[i]-'a' , b=s[i+1]-'A';
        if(a!=b)
        {
            vis[a]++;
            if(vis[b]==0)
                ans++;
            if(vis[b]>0)
                vis[b]--;
        }
    }

    cout<<ans;
	return 0;
}


/*     !ya khoda!     */
#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pp push
#define po pop()
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()

#define F first
#define S second
#define mkp make_pair
#define pll pair<ll,ll>

#define poow(a,b,M)   b?(poow((a*a)%M,b/2)%M * (b&1?a))%M:1 ;

#define IOS ios_base::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
#define coutashar(x,d)   cerr<<fixed<<setprecision(x)<<(ld)d
#define coutghat(x)      cout<<tolower(x);
/*==========================================================================*/
using namespace std;
/*==========================================================================*/
const ll N=2e5+100;
ll n,ans , a,b,vis[N];
string s;
/*==========================================================================*/
int main()
{
    IOS;

    cin>>n>>s;   n=s.size();
    for(int i=0;i<n-1;i+=2)
    {
        a=s[i]-'a' , b=s[i+1]-'A';
        if(a!=b)
        {
            vis[a]++;
            if(vis[b]==0)
                ans++;
            if(vis[b]==1)
                vis[b]--;
        }
    }

    cout<<ans;
	return 0;
}


/*     !ya khoda!     */
#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pp push
#define po pop()
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()

#define F first
#define S second
#define mkp make_pair
#define pll pair<ll,ll>

#define poow(a,b,M)   b?(poow((a*a)%M,b/2)%M * (b&1?a))%M:1 ;

#define IOS ios_base::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
#define coutashar(x,d)   cerr<<fixed<<setprecision(x)<<(ld)d
#define coutghat(x)      cout<<tolower(x);
/*==========================================================================*/
using namespace std;
/*==========================================================================*/
const ll N=2e5+100;
ll n,ans , a,b;
string s;
bool vis[N];
/*==========================================================================*/
int main()
{
    IOS;

    cin>>n>>s;   n=s.size();
    for(int i=0;i<n-1;i+=2)
    {
        a=s[i]-'a' , b=s[i+1]-'A';
        if(a!=b)
        {
            vis[a]=1;
            if(vis[b]==0)
                ans++;
            if(vis[b]==1)
                for(int i=0;i<30;i++)
                    vis[i]=0;
        }
        else
            for(int i=0;i<30;i++)
                vis[i]=0;
    }

    cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
#include<vector>
#define ll long long
using namespace std;

int main()
{
    int n,x=0;
    cin>>n;
    string s;
    cin>>s;
    map<char,int> m;

    for(int i=0;i<(2*n-2);i+=2)
    {
       m[s[i]]++;
       if(m[tolower(s[i+1])]>=1) m[tolower(s[i+1])]--;
       else x++;
    }
    cout<<x;
}


#include<bits/stdc++.h>
#include<vector>
#include<string>
#define pb   push_back
#define rep(i,a,n)  for(int i=a;i<n;i++)
#define ll  long long
using namespace std;

int main()
{
    int n,x=0;
    cin>>n;
    vector<char> v;
    string s;
    char c;
    cin>>s;
    for(int i=0;i<(2*n-2);)
    {

        c=tolower(s[i+1]);
        if(s[i]==c)
        {
            i=i+2;
            //remove(v.begin(),v.end(),c);
        }
        else if(find(v.begin(),v.end(),c)!=v.end())
        {
            i=i+2;
            remove(v.begin(),v.end(),c);
        }
        else
        {
            x++;
            i=i+2;
            v.pb(s[i]);
        }

    }
    cout<<x;
}


#include <bits/stdc++.h>
#include<vector>
#define ll long long
using namespace std;

int main()
{
    int n,x=0;
    cin>>n;
    string s;
    cin>>s;
    vector<char> v;
    for(int i=0;i<(2*n-2);i+=2)
    {
        v.push_back(s[i]);
        auto it=find(v.begin(),v.end(),tolower(s[i+1]));
        if(it!=v.end())
        {
            v.erase(it);
        }
        else x++;
    }
    cout<<x;
}


#include<bits/stdc++.h>
#include<vector>
#include<string>
#define pb   push_back
#define rep(i,a,n)  for(int i=a;i<n;i++)
#define ll  long long
using namespace std;

int main()
{
    int n,x=0;
    cin>>n;
    vector<char> v;
    string s;
    char c;
    cin>>s;
    for(int i=0;i<(2*n-2);)
    {
        c=tolower(s[i+1]);
        if(s[i]==c)
        {
            i=i+2;
        }
        else if(find(v.begin(),v.end(),c)!=v.end())
        {
            i=i+2;
        }
        else
        {
            x++;
            i=i+2;
            v.pb(s[i]);
        }

    }
    cout<<x;
}


#include<bits/stdc++.h>
#include<vector>
#include<string>
#define pb   push_back
#define rep(i,a,n)  for(int i=a;i<n;i++)
#define ll  long long
using namespace std;

int main()
{
    int n,x=0;
    cin>>n;
    vector<char> v;
    string s;
    char c;
    cin>>s;
    for(int i=0;i<(2*n-2);)
    {
        c=tolower(s[i+1]);
        if(s[i]==c)
        {
            i=i+2;
        }
        else if(find(v.begin(),v.end(),c)!=v.end())
        {
            i=i+2;
        }
        else
        {
            x++;
            i=i+2;
        }
        v.pb(s[i]);
    }
    cout<<x;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin>>n;
    string s;
    cin>>s;
    int key[26] = {0};
    int l = s.length();
    int count = 0;
    for(int i = 0; i < l; i++){
        if(islower(s[i])){
            key[s[i]%97]++;
        }
        else {
            if(key[s[i]%65]){
                key[s[i]%65]--;
            }
            else{
                count++;
            }
        }
    }
    cout<<count<<endl;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin>>n;
    string s;
    cin>>s;
    bool key[26] = {false};
    int l = s.length();
    int count = 0;
    for(int i = 0; i < l; i++){
        if(islower(s[i])){
            key[s[i]%97] = true;
        }
        else {
            if(key[s[i]%65]){
                key[s[i]%65] = false;
            }
            else{
                count++;
            }
        }
    }
    cout<<count<<endl;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin>>n;
    string s;
    cin>>s;
    bool key[26] = {false};
    long long int  l = s.length();
    int count = 0;
    for(long long int i = 0; i < l; i++){
        if(islower(s[i])){
            key[s[i]%97] = true;
        }
        else {
            if(key[s[i]%65]){
                key[s[i]%65] = false;
            }
            else{
                count++;
            }
        }
    }
    cout<<count<<endl;
}