#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

#define MAX_LENTH 1000

int main()
{
    char str1[MAX_LENTH];
    char opt[] = {"WTYUIOHAXVM"};
    int flag;
    cin>>str1;
    for (int i = 0; i < strlen(str1); i++)
    {
        flag = 0;
        for (int j = 0; j < strlen(opt); j++)
        {
            if(str1[i] == opt[j])
                flag = 1;
        }
        if(flag == 0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    for (int i = 0; i < strlen(str1)/2 + 1; i++)
    {
        if(str1[i] != str1[strlen(str1) - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


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

#define MAX 10000

int main()
{
    char name[MAX];
    char symmetry[12] = {"AWTYUIOHXVM"};
    cin>>name;
    int i,j;
    for(i = 0 ; i < strlen(name)/2 + 1 ; i++)
    {
        int flag = 0;
        for(j = 0 ; j < 12 ; j++)
        {
            if(name[i] == symmetry[j])
            {
                flag = 1;
            }
        }
        if(name[i] != name[strlen(name)-i-1] || flag == 0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


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

#define MAX 10000

int main()
{
	char name[MAX];
	char symmetry[12] = {"AWTYUIOHXVM"};
	cin>>name;
	int i,j;
	for(i = 0 ; i < strlen(name)/2 + 1 ; i++)
	{
		int flag = 0;
		for(j = 0 ; j < 12 ; j++)
		{
			if(name[i] == symmetry[j])
			{
				flag = 1;
			}
		}
		if(name[i] != name[strlen(name)-i-1] || flag == 0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

#define MAX_LENTH 100005

char str1[MAX_LENTH];

int main()
{
    char str2[] = {"WTYUIOHAMVX"},ch;
    int counter = 0;
    while(1)
    {
        int flag = 0;
        ch = getchar();
        if(ch == '\n')
            break;
        for (int j = 0; j < 11; j++)
        {
            if(ch == str2[j])
                flag = 1;
        }
        if(flag == 0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        str1[counter++] = ch;
    }
    str1[counter] = '\0';
    int len1 = counter;
    for (int i = 0; i <= len1/2; i++)
    {
        if(str1[i] != str1[len1 - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


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

int main()
{
	char name[100];
	char symmetry[12] = {"AWTYUIOHXVM"};
	cin>>name;
	int i,j;
	for(i = 0 ; i < strlen(name)/2 ; i++)
	{
		int flag = 0;
		for(j = 0 ; j < 12 ; j++)
		{
			if(name[i] == symmetry[j])
			{
				flag = 1;
			}
		}
		if(name[i] != name[strlen(name)-i-1] || flag == 0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}


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

#define MAX_LENTH 100

int main()
{
    char str1[MAX_LENTH];
    char str2[] = {"WTYUIOHAMVX"};
    cin>>str1;
    int len1 = strlen(str1);
    for (int i = 0; i < len1; i++)
    {
        int flag = 0;
        for (int j = 0; j < 11; j++)
        {
            if(str1[i] == str2[j])
                flag = 1;
        }
        if(flag == 0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    for (int i = 0; i <= len1/2; i++)
    {
        if(str1[i] != str1[len1 - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


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

#define MAX_LENTH 100

int main()
{
    char str1[MAX_LENTH];
    char str2[] = {"WTYUIOHAMVX"},ch;
    int counter = 0;
    int flag = 0;
    cin>>str1;
    while(1)
    {
        ch = getchar();
        if(ch == '\n')
            break;
        for (int j = 0; j < 11; j++)
        {
            if(ch == str2[j])
                flag = 1;
        }
        if(flag == 0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        str1[counter++] = ch;
    }
    int len1 = counter;
    for (int i = 0; i <= len1/2; i++)
    {
        if(str1[i] != str1[len1 - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

#define MAX_LENTH 100

int main()
{
    char str1[MAX_LENTH];
    char str2[] = {"WTYUIOHAMVX"},ch;
    int counter = 0;
    while(1)
    {
        int flag = 0;
        ch = getchar();
        if(ch == '\n')
            break;
        for (int j = 0; j < 11; j++)
        {
            if(ch == str2[j])
                flag = 1;
        }
        if(flag == 0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        str1[counter++] = ch;
    }
    str1[counter] = '\0';
    int len1 = counter;
    for (int i = 0; i <= len1/2; i++)
    {
        if(str1[i] != str1[len1 - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


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

int main()
{
    char name[100];
    cin>>name;
    int i;
    if(strlen(name) == 1)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    for(i = 0 ; i < strlen(name)/2 ; i++)
    {
        if(name[i] != name[strlen(name)-i-1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


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

int main()
{
	char name[100];
	char symmetry[12] = {"AWTYUIOHXVM"};
	cin>>name;
	int i,j;
	for(i = 0 ; i < strlen(name)/2 + 1 ; i++)
	{
		int flag = 0;
		for(j = 0 ; j < 12 ; j++)
		{
			if(name[i] == symmetry[j])
			{
				flag = 1;
			}
		}
		if(name[i] != name[strlen(name)-i-1] || flag == 0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}


#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

#define MAX_LENTH 1000

int main()
{
    char str1[MAX_LENTH];
    char opt[] = {"WTYUIOHAXVM"};
    int F[27] = {0};
    char ch;
    int flag,counter = 0,sum = 0;
    while(1)
    {
        ch = getchar();
        if(ch == '\n')
            break;
        str1[counter++] = ch;
        F[ch - 'A']++;
    }
    str1[counter] = '\0';
    for (int i = 0; i < strlen(opt); i++)
    {
        sum += F[opt[i] - 'A'];
    }
    if(sum != counter)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    for (int i = 0; i < strlen(str1)/2 + 1; i++)
    {
        if(str1[i] != str1[strlen(str1) - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<cstring>
#include<cmath>
#include<stdio.h>
using namespace std;

#define MAX_LENTH 1000

int main()
{
    char str1[MAX_LENTH];
    char opt[] = {"WTYUIOHAXVM"};
    int F[27] = {0};
    char ch;
    int flag,counter = 0,sum = 0;
    while(1)
    {
        ch = getchar();
        if(ch == '\n')
            break;
        str1[counter++] = ch;
        F[ch - 'A']++;
    }
    str1[counter] = '\0';
    for (int i = 0; i < strlen(opt); i++)
    {
        sum += F[opt[i] - 'A'];
    }
    if(sum != counter)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    for (int i = 0; i < strlen(str1)/2 + 1; i++)
    {
        if(str1[i] != str1[strlen(str1) - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


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

int main()
{
	char name[100];
	cin>>name;
	int i;
	for(i = 0 ; i < strlen(name)/2 ; i++)
	{
		if(name[i] != name[strlen(name)-i-1])
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

#define MAX_LENTH 10000

char str1[MAX_LENTH];

int main()
{
	char str2[] = {"WTYUIOHAMVX"},ch;
	int counter = 0;
	while(1)
	{
		int flag = 0;
		ch = getchar();
		if(ch == '\n')
			break;
		for (int j = 0; j < 11; j++)
		{
			if(ch == str2[j])
				flag = 1;
		}
		if(flag == 0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
		str1[counter++] = ch;
	}
	str1[counter] = '\0';
	int len1 = counter;
	for (int i = 0; i <= len1/2; i++)
	{
		if(str1[i] != str1[len1 - i - 1])
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}


#include<iostream>
#include<cstring>
#include<cmath>
#include<stdio.h>
using namespace std;

#define MAX_LENTH 1000

int main()
{
    char str1[MAX_LENTH];
    char symmetry[] = {"WTYUIOHAXVM"};
    int F[27] = {0};
    char ch;
    int flag,counter = 0,sum = 0 , len1;
    while(1)
    {
        ch = getchar();
        if(ch == '\n')
            break;
        str1[counter++] = ch;
        F[ch - 'A']++;
    }
    str1[counter] = '\0';
    len1 = counter;
    for (int i = 0; i < 11; i++)
    {
        sum += F[symmetry[i] - 'A'];
    }
    if(sum != counter)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    for (int i = 0; i < len1 /2 + 1; i++)
    {
        if(str1[i] != str1[strlen(str1) - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

#define MAX_LENTH 100

int main()
{
    char str1[MAX_LENTH];
    char str2[] = {"WTYUIOHAMVX"},ch;
    int counter = 0;
    int flag = 0;
    cin>>str1;
    while(1)
    {
        ch = getchar();
        if(ch == '\n')
            break;
        for (int j = 0; j < 11; j++)
        {
            if(ch == str2[j])
                flag = 1;
        }
        if(flag == 0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        str1[counter++] = ch;
    }
    int len1 = counter;
    for (int i = 0; i <= len1/2; i++)
    {
        if(str1[i] != str1[len1 - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }

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


#include<bits/stdc++.h>

#define clear(a) memset(a, sizeof(a), 0)
#define inf(a) memset(a, sizeof(a), -1)
#define sz s.size()
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define pb() push_back()
#define p_b() pop_back()

using namespace std;
string s;
const int INF = 10e9;
main()
    {
    ios_base::sync_with_stdio(false);
	cin >> s;
	string b = s;
	reverse(s.begin(), s.end());
	if(s != b)
		{
		cout << "NO";
		return 0;
		}
	if(s.size() % 2 == 0)
		{
		if(s[s.size() / 2] == s[s.size() / 2 + 1])
			{
			cout << "YES";
			return 0;
			}
		cout << "NO";
		return 0;
		}
	if(s[s.size() / 2 + 1] == 'H' || s[s.size() / 2 + 1] == 'X' || s[s.size() / 2 + 1] == 'Y' || s[s.size() / 2 + 1] == 'W' || s[s.size() / 2 + 1] == 'T' || s[s.size() / 2 + 1] == 'U' || s[s.size() / 2 + 1] == 'I' || s[s.size() / 2 + 1] == 'O' || s[s.size() / 2 + 1] == 'A' || s[s.size() / 2 + 1] == 'V' || s[s.size() / 2 + 1] == 'M')
		{
		cout << "YES";
		return 0;
		}
	cout << "NO";
	return 0;
	}


#include<bits/stdc++.h>

#define clear(a) memset(a, sizeof(a), 0)
#define inf(a) memset(a, sizeof(a), -1)
#define sz s.size()
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define pb() push_back()
#define p_b() pop_back()

using namespace std;
string s;
int ans;
const int INF = 10e9;
main()
    {
    ios_base::sync_with_stdio(false);
	cin >> s;
	string b = s;
	reverse(s.begin(), s.end());
	if(s != b)
		{
		cout << "NO";
		return 0;
		}
	for(int i = 0; i < s.size(); i++)
		{
		if(s[i] == 'H' || s[i] == 'X' || s[i] == 'Y' || s[i] == 'W' || s[i] == 'T' || s[i] == 'U' || s[i] == 'I' || s[i] == 'O' || s[i] == 'A' || s[i] == 'V' || s[i] == 'M')
			{
			ans ++;
			}
		}
	if(ans == s.size() && s == b)
		{
		cout << "YES";
		return 0;
		}
	cout << "NO";
	}


#include<bits/stdc++.h>

#define clear(a) memset(a, sizeof(a), 0)
#define inf(a) memset(a, sizeof(a), -1)
#define sz s.size()
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define pb() push_back()
#define p_b() pop_back()

using namespace std;
string s;
const int INF = 10e9;
main()
    {
    ios_base::sync_with_stdio(false);
	cin >> s;
	string b = s;
	if(s.size() == 2)
		{
		if(s[0] == s[1])
			{
			cout << "YES";
			return 0;
			}
		cout << "NO";
		return 0;
		}
	reverse(s.begin(), s.end());
	if(s != b)
		{
		cout << "NO";
		return 0;
		}
	if(s.size() % 2 == 0)
		{
		if(s[s.size() / 2] == s[s.size() / 2 - 1])
			{
			cout << "YES";
			return 0;
			}
		cout << "NO";
		return 0;
		}
	if(s[s.size() / 2 + 1] == 'H' || s[s.size() / 2 + 1] == 'X' || s[s.size() / 2 + 1] == 'Y' || s[s.size() / 2 + 1] == 'W' || s[s.size() / 2 + 1] == 'T' || s[s.size() / 2 + 1] == 'U' || s[s.size() / 2 + 1] == 'I' || s[s.size() / 2 + 1] == 'O' || s[s.size() / 2 + 1] == 'A' || s[s.size() / 2 + 1] == 'V' || s[s.size() / 2 + 1] == 'M')
		{
		cout << "YES";
		return 0;
		}
	cout << "NO";
	return 0;
	}


#include<bits/stdc++.h>

#define clear(a) memset(a, sizeof(a), 0)
#define inf(a) memset(a, sizeof(a), -1)
#define sz s.size()
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define pb() push_back()
#define p_b() pop_back()

using namespace std;
string s;
const int INF = 10e9;
main()
    {
    ios_base::sync_with_stdio(false);
	cin >> s;
	string b = s;
	reverse(s.begin(), s.end());
	if(s != b)
		{
		cout << "NO";
		return 0;
		}
	if(s.size() % 2 == 0)
		{
		if(s[s.size() / 2] == s[s.size() / 2 - 1])
			{
			cout << "YES";
			return 0;
			}
		cout << "NO";
		return 0;
		}
	if(s[s.size() / 2 + 1] == 'H' || s[s.size() / 2 + 1] == 'X' || s[s.size() / 2 + 1] == 'Y' || s[s.size() / 2 + 1] == 'W' || s[s.size() / 2 + 1] == 'T' || s[s.size() / 2 + 1] == 'U' || s[s.size() / 2 + 1] == 'I' || s[s.size() / 2 + 1] == 'O' || s[s.size() / 2 + 1] == 'A' || s[s.size() / 2 + 1] == 'V' || s[s.size() / 2 + 1] == 'M')
		{
		cout << "YES";
		return 0;
		}
	cout << "NO";
	return 0;
	}


//by 23-ASKAR-BAYGENZHIN-7
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<fstream>
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
string a,b;
cin>>a;
for(int i=0;i<a.size();i++)
{
if(a[i]!='A' || a[i]!='H' || a[i]!='I' || a[i]!='M' || a[i]!='O' || a[i]!='V' || a[i]!='W' || a[i]!='Y' || a[i]!='X' || a[i]!='U' || a[i]!='T'){cout<<"NO";return 0;}
}
if(a.size()==1){cout<<"NO";return 0;}
b=a;
reverse(a.begin(),a.end());
if(a==b){cout<<"YES";}
else{cout<<"NO";}
return 0;
}


//
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<fstream>
#include<iomanip>
#include<queue>
#include<stack>
using namespace std;
const int INF = int(1e9);
int n, m;
int a[111111];
int ans;
pair<int, int> p[111111];
string s;
string t;
bool bl;
int used[111111];
int main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios_base::sync_with_stdio(false);
	cin >> s;
	t = s;
	reverse(s.begin(), s.end());
	if( s != t ) cout << "NO";
	else
	{
		for( int i = 0; i < s.size(); i++)
			if( s[i] != 'H' && s[i] != 'A' && s[i] != 'X' && s[i] != 'Y' && s[i] != 'U' && s[i] != 'O' && s[i] != 'W' && s[i] != 'v' && s[i] != 'M' && s[i] != 'T' )
			{
				cout << "NO";
				return 0;
			}
		cout << "YES";
	}
	return 0;
}


//by 23-ASKAR-BAYGENZHIN-7
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<fstream>
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
string a,b;
cin>>a;
if(a.size()==1){cout<<"NO";return 0;}
b=a;
reverse(a.begin(),a.end());
if(a==b){cout<<"YES";}
else{cout<<"NO";}
return 0;
}


//
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<fstream>
#include<iomanip>
#include<queue>
#include<stack>
using namespace std;
const int INF = int(1e9);
int n, m;
int a[111111];
int ans;
pair<int, int> p[111111];
string s;
string t;
bool bl;
int used[111111];
int main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios_base::sync_with_stdio(false);
	cin >> s;
	t = s;
	reverse(s.begin(), s.end());
	if( s != t ) cout << "NO";
	else
	{
		for( int i = 0; i < s.size(); i++)
			if( s[i] != 'H' && s[i] != 'A' && s[i] != 'X' && s[i] != 'Y' && s[i] != 'U' && s[i] != 'O' && s[i] != 'W' && s[i] != 'v' && s[i] != 'M' )
			{
				cout << "NO";
				return 0;
			}
		cout << "YES";
	}
	return 0;
}


//by 23-ASKAR-BAYGENZHIN-7
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<fstream>
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
string a,b;
int x=0,z=0;
cin>>a;
for(int i=0;i<a.size();i++)
{
if(a[i]=='A' || a[i]=='H' || a[i]=='I' || a[i]=='M' || a[i]=='O' || a[i]=='V' || a[i]=='W' || a[i]=='Y' || a[i]=='X' || a[i]=='U' || a[i]=='T'){z++;}
else{x++;}
}
if(x>0){cout<<"NO";return 0;}
b=a;
reverse(a.begin(),a.end());
if(a==b){cout<<"YES";}
else{cout<<"NO";}
return 0;
}


//
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<fstream>
#include<iomanip>
#include<queue>
#include<stack>
using namespace std;
const int INF = int(1e9);
int n, m;
int a[111111];
int ans;
pair<int, int> p[111111];
string s;
string t;
bool bl;
int used[111111];
int main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios_base::sync_with_stdio(false);
	cin >> s;
	t = s;
	reverse(s.begin(), s.end());
	if( s != t ) cout << "NO";
	else
	{
		for( int i = 0; i < s.size(); i++)
			if( s[i] != 'H' && s[i] != 'A' && s[i] != 'X' && s[i] != 'Y' && s[i] != 'U' && s[i] != 'O' && s[i] != 'W' && s[i] != 'v' && s[i] != 'M' && s[i] != 'T' && s[i] != 'I ')
			{
				cout << "NO";
				return 0;
			}
		cout << "YES";
	}
	return 0;
}


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

int main() {
    // your code goes here
    string n;
    cin >> n;
    int s = n.length();
    if (s == 1)
    {
        cout << "NO";
            return 0;
}
    for (int i=0; i< s; i++)
    {
        if (n[i] == n[s - i - 1])
        {
            if (n[i] != 'A' && n[i] != 'H' && n[i] != 'I' && n[i] != 'M' && n[i] != 'O' && n[i] != 'T' && n[i] != 'U' && n[i] != 'V' &&
                    n[i] != 'X' && n[i] != 'Y')
            {
                cout << "NO";
                return 0;
            }
        } else {
                cout << "NO";
                return 0;
            }
    }
    cout << "YES";
    return 0;
}


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

int main() {
    // your code goes here
    string n;
    cin >> n;
    int s = n.length();
    if (s == 1)
    {
        cout << "NO";
            return 0;
}
    for (int i=0; i< s; i++)
    {
        if (n[i] != n[s - i - 1])
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


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

int main() {
    // your code goes here
    string n;
    cin >> n;
    int s = n.length();
    if (s == 1)
    {
        cout << "NO";
            return 0;
}
    for (int i=0; i< s; i++)
    {
        if (n[i] == n[s - i - 1])
        {
            if (n[i] != 'A' && n[i] != 'H' && n[i] != 'I' && n[i] != 'M' && n[i] != 'O' && n[i] != 'T' && n[i] != 'U' && n[i] != 'V' &&
                    n[i] != 'X' && n[i] != 'Y' && n[i] != 'W')
            {
                cout << "NO";
                return 0;
            }
        } else {
                cout << "NO";
                return 0;
            }
    }
    cout << "YES";
    return 0;
}


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

int main() {
    // your code goes here
    string n;
    cin >> n;
    int s = n.length();
    for (int i=0; i< s; i++)
    {
        if (n[i] == n[s - i - 1])
        {
            if (n[i] != 'A' && n[i] != 'H' && n[i] != 'I' && n[i] != 'M' && n[i] != 'O' && n[i] != 'T' && n[i] != 'U' && n[i] != 'V' &&
                    n[i] != 'X' && n[i] != 'Y' && n[i] != 'W')
            {
                cout << "NO";
                return 0;
            }
        } else {
                cout << "NO";
                return 0;
            }
    }
    cout << "YES";
    return 0;
}


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

int main() {
    // your code goes here
    string n;
    cin >> n;
    int s = n.length();
    for (int i=0; i< s; i++)
    {
        if (n[i] != n[s - i - 1])
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>

#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define clr(arr, key) memset(arr, key, sizeof arr)
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define oo (1 << 28)
#define ll long long
#define llu unsigned long long int
#define PI acos(-1)
#define CF ios_base::sync_with_stdio(0);cin.tie(0);
#define all(v) v.begin(), v.end()
#define no_of_ones __builtin_popcount // count 1's in a numbers binary representation
#define SZ(v) (int)(v.size())
#define eps 10e-7

//int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int col[4] = {1, 0, -1, 0};
//int row[4] = {0, 1, 0, -1};
//int months[13] = {0, ,31,28,31,30,31,30,31,31,30,31,30,31};

using namespace std;

int main()
{
#ifdef MANSUR
//        in;
//        out;
#endif
    CF

    int m;
    string s;
    map<char,int> mp;

    s="AHIMOTUVWXY";
    mp.clear();
    for(int i=0; i<s.size(); i++) mp[s[i]]++;

    while(cin>>s)
    {
        m=s.size()/2;
        bool flag=true;
        for(int i=0; i<=m; i++)
        {
            if(mp[s[i]]>0 && s[i]==s[s.size()-i-1]);
            else
            {
                flag=false;
                break;
            }
        }
        if(flag) puts("YES");
        else puts("NO");
    }
    return 0;
}


#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>

#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define clr(arr, key) memset(arr, key, sizeof arr)
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define oo (1 << 28)
#define ll long long
#define llu unsigned long long int
#define PI acos(-1)
#define CF ios_base::sync_with_stdio(0);cin.tie(0);
#define all(v) v.begin(), v.end()
#define no_of_ones __builtin_popcount // count 1's in a numbers binary representation
#define SZ(v) (int)(v.size())
#define eps 10e-7

//int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int col[4] = {1, 0, -1, 0};
//int row[4] = {0, 1, 0, -1};
//int months[13] = {0, ,31,28,31,30,31,30,31,31,30,31,30,31};

using namespace std;

int main()
{
#ifdef MANSUR
//        in;
//        out;
#endif
    CF

    int m;
    string s;
    map<char,int> mp;

    s="AHIMOSTUVWXY";
    mp.clear();
    for(int i=0; i<s.size(); i++) mp[s[i]]++;

    while(cin>>s)
    {
        m=s.size()/2;
        bool flag=true;
        for(int i=0; i<=m; i++)
        {
            if(mp[s[i]]>0 && s[i]==s[s.size()-i-1]);
            else
            {
                flag=false;
                break;
            }
        }
        if(flag) puts("YES");
        else puts("NO");
    }
    return 0;
}


#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>

#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define clr(arr, key) memset(arr, key, sizeof arr)
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define oo (1 << 28)
#define ll long long
#define llu unsigned long long int
#define PI acos(-1)
#define CF ios_base::sync_with_stdio(0);cin.tie(0);
#define all(v) v.begin(), v.end()
#define no_of_ones __builtin_popcount // count 1's in a numbers binary representation
#define SZ(v) (int)(v.size())
#define eps 10e-7

//int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int col[4] = {1, 0, -1, 0};
//int row[4] = {0, 1, 0, -1};
//int months[13] = {0, ,31,28,31,30,31,30,31,31,30,31,30,31};

using namespace std;

int main()
{
#ifdef MANSUR
//        in;
//        out;
#endif
    CF
    string s,ss;

    while(cin>>s)
    {
        ss=s;
        reverse(s.begin(), s.end());
        if(s==ss) puts("YES");
        else puts("NO");
    }
    return 0;
}


#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>

#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define clr(arr, key) memset(arr, key, sizeof arr)
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define oo (1 << 28)
#define ll long long
#define llu unsigned long long int
#define PI acos(-1)
#define CF ios_base::sync_with_stdio(0);cin.tie(0);
#define all(v) v.begin(), v.end()
#define no_of_ones __builtin_popcount // count 1's in a numbers binary representation
#define SZ(v) (int)(v.size())
#define eps 10e-7

//int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int col[4] = {1, 0, -1, 0};
//int row[4] = {0, 1, 0, -1};
//int months[13] = {0, ,31,28,31,30,31,30,31,31,30,31,30,31};

using namespace std;

int main()
{
#ifdef MANSUR
//        in;
//        out;
#endif
    CF
    string s,ss;

    while(cin>>s)
    {
        if(s.size()==1)
        {
            puts("NO");
            continue;
        }
        ss=s;
        reverse(s.begin(), s.end());
        if(s==ss) puts("YES");
        else puts("NO");
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <math.h>
#include <stdio.h>

using namespace std;
#define ll long long

int main(void) {
	string str;
	cin >> str;
	char reflected[] = {'A', 'H', 'I', 'M', 'O', 'T', 'U', 'V', 'W', 'X', 'Y'};
	int n = 10;

	int to = str.length()/2-1;
	if(str.length() % 2 != 0) {
		to = str.length()/2;
	}
	for(int i = 0; i <= to; i++) {
		int opp = str.length() - i - 1;
		if(str[i] != str[opp]) {
			cout << "NO" << endl;
			return 0;
		}

		if(find(reflected, reflected+n, str[i]) == reflected+n) {
			cout << "NO" << endl;

			if(str.length() > 20) {
				cout << "NAH DAWG, on char: "  << str[i] << endl;
			}
			return 0;
		}
	}

	cout << "YES" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <math.h>
#include <stdio.h>

using namespace std;
#define ll long long

int main(void) {
	string str;
	cin >> str;
	char reflected[] = {'A', 'H', 'I', 'M', 'O', 'T', 'U', 'V', 'W', 'X', 'Y'};
	int n = 10;

	int to = str.length()/2-1;
	if(str.length() % 2 != 0) {
		to = str.length()/2;
	}
	for(int i = 0; i <= to; i++) {
		int opp = str.length() - i - 1;
		if(str[i] != str[opp]) {
			cout << "NO" << endl;
			return 0;
		}

		if(find(reflected, reflected+n, str[i]) == reflected+n) {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <math.h>
#include <stdio.h>

using namespace std;
#define ll long long

int main(void) {
	string str;
	cin >> str;
	char reflected[] = {'A', 'H', 'I', 'M', 'O', 'T', 'U', 'V', 'W', 'X'};
	int n = 10;

	int to = str.length()/2-1;
	if(str.length() % 2 != 0) {
		to = str.length()/2;
	}
	for(int i = 0; i <= to; i++) {
		int opp = str.length() - i - 1;
		if(str[i] != str[opp]) {
			cout << "NO" << endl;
			return 0;
		}

		if(opp == i && (find(reflected, reflected+n, str[i]) == reflected+n)) {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <math.h>
#include <stdio.h>

using namespace std;
#define ll long long

int main(void) {
	string str;
	cin >> str;
	char reflected[] = {'A', 'H', 'I', 'M', 'O', 'T', 'U', 'V', 'W', 'X', 'Y'};
	int n = 11;

	int to = str.length()/2-1;
	if(str.length() % 2 != 0) {
		to = str.length()/2;
	}
	for(int i = 0; i <= to; i++) {
		int opp = str.length() - i - 1;
		if(str[i] != str[opp]) {
			cout << "NO" << endl;
			return 0;
		}

		if(find(reflected, reflected+n, str[i]) == reflected+n) {
			cout << "NO" << endl;

			return 0;
		}
	}

	cout << "YES" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <math.h>
#include <stdio.h>

using namespace std;
#define ll long long

int main(void) {
	string str;
	cin >> str;
	char reflected[] = {'A', 'H', 'I', 'M', 'O', 'T', 'U', 'V', 'W', 'X'};
	int n = 10;

	int to = str.length()/2-1;
	if(str.length() % 2 != 0) {
		to = str.length()/2;
	}
	for(int i = 0; i <= to; i++) {
		int opp = str.length() - i - 1;
		if(str[i] != str[opp]) {
			cout << "NO" << endl;
			return 0;
		}

		if(find(reflected, reflected+n, str[i]) == reflected+n) {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;

char s[1000];
bool x=1;
int j;

int main()
{
	cin >> s;
	j = strlen(s);
	for(int i=0; i<j; i++)
	{
		if(s[i]==s[j-i-1])
		x=1;
		else
		{
			x=0;
			break;
		}
	}
	if(x==1)
	cout << "YES";
	else cout << "NO";
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int>         ii;
typedef long long              ll;
typedef vector<int>            vi;
typedef vector<ii>            vii;
typedef set<int>               si;

#define maxn 200100
#define F first
#define S second
#define pb push_back
#define pq priority_queue
#define mp make_pair
#define INF 0x3F3F3F3F
#define mmc(x,y) (x/__gcd(x,y))*y

int main(){
    string str;
    cin>>str;
    int r=0;
    if(str.size()==1){
    if(str[r]!='A'&& str[r]!='H' && str[r]!='I'&& str[r]!='M'&& str[r]!='O'&& str[r]!='T'&& str[r]!='U'&& str[r]!='V'&& str[r]!='W'&& str[r]!='X'&& str[r]!='Y'){
    printf("NO\n");
    }
    else printf("YES\n");
    return 0;
    }
    bool flag=1;
    int l=(str.size()/2)-1;
    r=str.size()/2;
    if(str.size()%2){

        if(str[r]!='A'&& str[r]!='H' && str[r]!='I'&& str[r]!='M'&& str[r]!='O'&& str[r]!='T'&& str[r]!='U'&& str[r]!='V'&& str[r]!='W'&& str[r]!='X'&& str[r]!='Y'){
        flag=0;
        }
        r++;
    }
    int aux;
    while(l>=0 && flag){
        if(str[r]!='A'&& str[r]!='H' && str[r]!='I'&& str[r]!='M'&& str[r]!='O'&& str[r]!='T'&& str[r]!='U'&& str[r]!='V'&& str[r]!='W'&& str[r]!='X'&& str[r]!='Y'){
            flag=0;
        }
        aux=r;
        r=l;
        if(str[r]!='A'&& str[r]!='H' && str[r]!='I'&& str[r]!='M'&& str[r]!='O'&& str[r]!='T'&& str[r]!='U'&& str[r]!='V'&& str[r]!='W'&& str[r]!='X'&& str[r]!='Y'){
            flag=0;
        }
        r=aux;
        if(str[l]!=str[r])flag=0;
        l--;
        r++;
    }
    printf("%s\n",flag?"YES":"NO");
    return 0;
}

// 1467999214104


    #include <bits/stdc++.h>
    #define END '\0'
    #define REP(i, a) for( int i = 0; i < a; i++ )
    #define RFOR(i,x,y) for(int i = x; i>= y; i--)
    #define FOR(i,x,y) for (int i = x; i < y; i++)
    #define ITFOR(it,A) for(typeof A.begin() it = A.begin(); it!=A.end(); it++)
    #define all(v) (v).begin(), (v).end()
    #define rall(v) (v).rbegin(), (v).rend()
    #define VE vector <int>
    #define mset(A,x) memset(A, x, sizeof A)
    #define PB push_back
    #define LL unsigned long long
    #define MAX 1000000
    using namespace std;
    /* int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; */ // 4 Direction
    /* int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; */ // 8 Direction
    /*int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; // Knight Direction
    /* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction

    const int n = 15;
    char a[n]={'Z','S','R','Q','P','L','K','N','J','G','F','E','D','C','B'};

    int main() {

    	//freopen("in.txt","r",stdin);
        string str;
        cin>>str;
        for(int i = 0; i<n;i++)
            if(str.find(a[i])!=string::npos)
            {
                puts("NO"); return 0;
            }
        bool f = false;
        int i = str.size()-1;
        for (int rit=0; rit<str.size()/2; ++rit, i--)
        {    if(str[rit] != str[i])
            {
                f=true;
            }

        }

                if(!f)
                puts("YES");
            else
                puts("NO");

     	//fclose(stdin);
        return 0;
    }
// 1468007828896


#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int>         ii;
typedef long long              ll;
typedef vector<int>            vi;
typedef vector<ii>            vii;
typedef set<int>               si;

#define maxn 200100
#define F first
#define S second
#define pb push_back
#define pq priority_queue
#define mp make_pair
#define INF 0x3F3F3F3F
#define mmc(x,y) (x/__gcd(x,y))*y

int main(){
    string str;
    cin>>str;
    if(str.size()==1){
    printf("NO\n");
    return 0;
    }
    int l=(str.size()/2)-1,r=str.size()/2;
    if(str.size()%2)r++;
    bool flag=1;
    while(l>=0){
        cout<<l<<" "<<r<<endl;
        if(str[l]!=str[r])flag=0;
        l--;
        r++;
    }
    printf("%s\n",flag?"YES":"NO");
    return 0;
}

// 1467996932353


#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int>         ii;
typedef long long              ll;
typedef vector<int>            vi;
typedef vector<ii>            vii;
typedef set<int>               si;

#define maxn 200100
#define F first
#define S second
#define pb push_back
#define pq priority_queue
#define mp make_pair
#define INF 0x3F3F3F3F
#define mmc(x,y) (x/__gcd(x,y))*y

int main(){
    string str;
    cin>>str;
    if(str.size()==1){
    printf("NO\n");
    return 0;
    }
    int l=(str.size()/2)-1,r=str.size()/2;
    if(str.size()%2)r++;
    bool flag=1;
    while(l>=0){
        if(str[l]!=str[r])flag=0;
        l--;
        r++;
    }
    printf("%s\n",flag?"SIM":"NO");
    return 0;
}

// 1467996597456


#include<bits/stdc++.h>
using namespace std;
#define el '\n'
int main()
{
    int l,n,t;
    string a;
    cin>>a;
    l=a.size();
    for(int i=0;i<l;i++)
    {
        if(a[i]=='A' || a[i]=='H' || a[i]== 'I' || a[i]== 'M' || a[i]== 'O' || a[i]== 'T' || a[i]== 'U' || a[i]=='V' ||a[i]== 'W' || a[i]== 'X' || a[i]== 'Y')
            continue;
        else
        {
            cout<<"NO"<<el;return 0;
        }
    }
    l=l/2;
    for(int i=0;i<l;i++)
    {
        if(a[i]!=a[a.size()-1-i])
        {
            cout<<"NO"<<el;
            return 0;
        }

    }
    cout<<"YES"<<el;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define el '\n'
int main()
{
    string a;
    cin>>a;
    int l=a.size()/2;
    if(l==0 || l)
    {
        if(l==1)
            {
                cout<<"NO"<<el;return 0;
            }
        else
        {
        for(int i=0; i<l; i++)
        {
            if(a[i]!=a[a.size()-1-i])
            {
                cout<<"NO"<<el;
                return 0;
            }
        }
        }
    }

    cout<<"YES"<<el;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define el '\n'
int main()
{
    int l,n,t;
    string a;
    cin>>a;
    l=a.size();
    for(int i=0;i<l;i++)
    {
        if(a[i]=='A' || a[i]=='H' || a[i]== 'I' || a[i]== 'M' || a[i]== 'O' || a[i]== 'T' || a[i]== 'U' || a[i]== 'W' || a[i]== 'X' || a[i]== 'Y')
            continue;
        else
        {
            cout<<"NO"<<el;return 0;
        }
    }
    l=l/2;
    for(int i=0;i<l;i++)
    {
        if(a[i]!=a[a.size()-1-i])
        {
            cout<<"NO"<<el;
            return 0;
        }

    }
    cout<<"YES"<<el;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define el '\n'
int main()
{
    string a;
    cin>>a;
    int l=a.size()/2;
    if(l)
    {
        if(l==1)
            {
                cout<<"NO"<<el;return 0;
            }
        else
        {
        for(int i=0; i<l; i++)
        {
            if(a[i]!=a[a.size()-1-i])
            {
                cout<<"NO"<<el;
                return 0;
            }
        }
        }
    }

    cout<<"YES"<<el;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define el '\n'
int main()
{
    string a;
    cin>>a;
    int l=a.size()/2;
        if(l==0)
            {
                cout<<"NO"<<el;return 0;
            }
        else
        {
        for(int i=0; i<l; i++)
        {
            if(a[i]!=a[a.size()-1-i])
            {
                cout<<"NO"<<el;
                return 0;
            }
        }
        }

    cout<<"YES"<<el;

    return 0;
}


/*420_A.cc

 Created on: Jul 11, 2014
     Author: prateepm
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <cassert>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <ctime>

using namespace std;

#define LET(x,a)        __typeof(a) x(a)
#define IFOR(i,a,b)     for(LET(i,a);i!=(b);++i)
#define EACH(it,v)      IFOR(it,v.begin(),v.end())
#define FOR(i,a,b)      for(int i=(int)(a) ; i < (int)(b);i++)
#define REP(i,n)        FOR(i,0,n)
#define SZ              size()
#define PB              push_back
#define PF              push_front
#define V(x)            vector< x >
#define two(X)          (1<<(X))
#define twoL(X)         (((int64)(1))<<(X))
#define contain(S,X)    (((S)&two(X))!=0)
#define containL(S,X)   (((S)&twoL(X))!=0
#define swap(x,y)       x ^=y ^= x^=y
#define ALL(v)          (v).begin(),(v).end()

const double pi=acos(-1.0);
const double eps=1e-11;
const int INFINITE=0x3f3f3f3f;
template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
template<class T> inline T lowbit(T n){return (n^(n-1))&n;}
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}

typedef V(int)          VI;
typedef V(VI)           VII;
typedef V(string)       VS;
typedef long long       int64;
typedef long double     LD;
typedef pair<int,int>   PI;

//#define LocalHost
string o    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string revo = "A??????HI???MNO????TUVWXY?";
char ref(char c) { return revo[c-'A']; }
int main()
{
#ifdef LocalHost
   freopen("input.txt","r",stdin);
//   freopen("output.txt","w",stdout);
#endif
   ios::sync_with_stdio( false);
   string s; cin >> s;
   int l = s.SZ, m = (l & 1) ? (l-1)/2 : l/2;
   int ok = 1;
   REP(i,m) {
//	   cout << s[i] << ' ' << ref(s[l-i+1]) << endl;
	   if(s[i] != ref(s[l-i+1]) ) {
		   ok = 0;
		   break;
	   }
   }
   if(l&1) ok = s[m] == ref(s[m]);
   cout << (ok ? "YES" : "NO") << endl;
   return 0;
}


/*420_A.cc

 Created on: Jul 11, 2014
     Author: prateepm
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <cassert>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <ctime>

using namespace std;

#define LET(x,a)        __typeof(a) x(a)
#define IFOR(i,a,b)     for(LET(i,a);i!=(b);++i)
#define EACH(it,v)      IFOR(it,v.begin(),v.end())
#define FOR(i,a,b)      for(int i=(int)(a) ; i < (int)(b);i++)
#define REP(i,n)        FOR(i,0,n)
#define SZ              size()
#define PB              push_back
#define PF              push_front
#define V(x)            vector< x >
#define two(X)          (1<<(X))
#define twoL(X)         (((int64)(1))<<(X))
#define contain(S,X)    (((S)&two(X))!=0)
#define containL(S,X)   (((S)&twoL(X))!=0
#define swap(x,y)       x ^=y ^= x^=y
#define ALL(v)          (v).begin(),(v).end()

const double pi=acos(-1.0);
const double eps=1e-11;
const int INFINITE=0x3f3f3f3f;
template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
template<class T> inline T lowbit(T n){return (n^(n-1))&n;}
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}

typedef V(int)          VI;
typedef V(VI)           VII;
typedef V(string)       VS;
typedef long long       int64;
typedef long double     LD;
typedef pair<int,int>   PI;

//#define LocalHost
string o    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string revo = "A??????HI???M?O????TUVWXY?";
char ref(char c) { return revo[c-'A']; }
int main()
{
#ifdef LocalHost
   freopen("input.txt","r",stdin);
//   freopen("output.txt","w",stdout);
#endif
   ios::sync_with_stdio( false);
   string s; cin >> s;
   int l = s.SZ, m = (l & 1) ? (l-1)/2 : l/2;
   int ok = 1;
   REP(i,m) {
//	   cout << s[i] << ' ' << ref(s[l-i+1]) << endl;
	   if(s[i] != ref(s[l-i-1]) ) {
		   ok = 0;
		   break;
	   }
   }
   if(l&1) {
	   ok &= s[m] == ref(s[m]);
   }
   cout << (ok ? "YES" : "NO") << endl;
   return 0;
}


/*420_A.cc

 Created on: Jul 11, 2014
     Author: prateepm
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <cassert>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <ctime>

using namespace std;

#define LET(x,a)        __typeof(a) x(a)
#define IFOR(i,a,b)     for(LET(i,a);i!=(b);++i)
#define EACH(it,v)      IFOR(it,v.begin(),v.end())
#define FOR(i,a,b)      for(int i=(int)(a) ; i < (int)(b);i++)
#define REP(i,n)        FOR(i,0,n)
#define SZ              size()
#define PB              push_back
#define PF              push_front
#define V(x)            vector< x >
#define two(X)          (1<<(X))
#define twoL(X)         (((int64)(1))<<(X))
#define contain(S,X)    (((S)&two(X))!=0)
#define containL(S,X)   (((S)&twoL(X))!=0
#define swap(x,y)       x ^=y ^= x^=y
#define ALL(v)          (v).begin(),(v).end()

const double pi=acos(-1.0);
const double eps=1e-11;
const int INFINITE=0x3f3f3f3f;
template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
template<class T> inline T lowbit(T n){return (n^(n-1))&n;}
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}

typedef V(int)          VI;
typedef V(VI)           VII;
typedef V(string)       VS;
typedef long long       int64;
typedef long double     LD;
typedef pair<int,int>   PI;

//#define LocalHost
string o    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string revo = "A??????HI???MNO????TUVWXY?";
char ref(char c) { return revo[c-'A']; }
int main()
{
#ifdef LocalHost
   freopen("input.txt","r",stdin);
//   freopen("output.txt","w",stdout);
#endif
   ios::sync_with_stdio( false);
   string s; cin >> s;
   int l = s.SZ, m = (l & 1) ? (l-1)/2 : l/2;
   int ok = 1;
   REP(i,m) {
//	   cout << s[i] << ' ' << ref(s[l-i+1]) << endl;
	   if(s[i] != ref(s[l-i-1]) ) {
		   ok = 0;
		   break;
	   }
   }
   if(l&1) {
	   ok &= s[m] == ref(s[m]);
   }
   cout << (ok ? "YES" : "NO") << endl;
   return 0;
}


/*420_A.cc

 Created on: Jul 11, 2014
     Author: prateepm
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <cassert>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <ctime>

using namespace std;

#define LET(x,a)        __typeof(a) x(a)
#define IFOR(i,a,b)     for(LET(i,a);i!=(b);++i)
#define EACH(it,v)      IFOR(it,v.begin(),v.end())
#define FOR(i,a,b)      for(int i=(int)(a) ; i < (int)(b);i++)
#define REP(i,n)        FOR(i,0,n)
#define SZ              size()
#define PB              push_back
#define PF              push_front
#define V(x)            vector< x >
#define two(X)          (1<<(X))
#define twoL(X)         (((int64)(1))<<(X))
#define contain(S,X)    (((S)&two(X))!=0)
#define containL(S,X)   (((S)&twoL(X))!=0
#define swap(x,y)       x ^=y ^= x^=y
#define ALL(v)          (v).begin(),(v).end()

const double pi=acos(-1.0);
const double eps=1e-11;
const int INFINITE=0x3f3f3f3f;
template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
template<class T> inline T lowbit(T n){return (n^(n-1))&n;}
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}

typedef V(int)          VI;
typedef V(VI)           VII;
typedef V(string)       VS;
typedef long long       int64;
typedef long double     LD;
typedef pair<int,int>   PI;

//#define LocalHost
string o    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string revo = "A??????HI???MNO????TUVWXY?";
char ref(char c) { return revo[c-'A']; }
int main()
{
#ifdef LocalHost
   freopen("input.txt","r",stdin);
//   freopen("output.txt","w",stdout);
#endif
   ios::sync_with_stdio( false);
   string s; cin >> s;
   int l = s.SZ, m = (l & 1) ? (l-1)/2 : l/2;
   int ok = 1;
   REP(i,m) {
//	   cout << s[i] << ' ' << ref(s[l-i+1]) << endl;
	   if(s[i] != ref(s[l-i-1]) ) {
		   ok = 0;
		   break;
	   }
   }
   if(l&1) {
	   ok = s[m] == ref(s[m]);
   }
   cout << (ok ? "YES" : "NO") << endl;
   return 0;
}


#include <bits/stdc++.h>

#define PI              3.14159265358979323846264338327950
#define pb              push_back
#define mp              make_pair
#define all(a)          (a).begin(), (a).end()
#define clr(a,h)        memset(a, (h), sizeof(a))
#define forn(i, n)      for(int i = 0; i < int(n); ++i)
#define ford(i, n)      for(int i = int(n); i >=0; --i)
#define fore(i, a, b)   for(int i = int(a); i <= int(b); ++i)
#define foreach(it, a)  for(typeof((a).begin()) it=(a).begin(); it != (a).end(); ++it)
#define rforeach(it, a) for(typeof((a).rbegin()) it=(a).rbegin(); it != (a).rend(); ++it)

using namespace std;

const int INF = int(1e9+7);
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef long long       ll;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vii>     vvii;
ifstream fcin("");
ofstream fcout("");
/*  CASOS DE PRUEBA:

*/
/*  RESULTADO:

*/
int main()
{
    string s;
    cin>>s;
    forn(i,s.length())
    {
        if (s[i]!='W' and s[i]!='T' and s[i]!='Y' and s[i]!='U' and s[i]!='I' and s[i]!='O' and s[i]!='A' and s[i]!='H' and s[i]!='H' and s[i]!='V' and s[i]!='M')
        {
            cout<<"NO";
            return 0;
        }
    }
    long long j=s.length()-1;
    forn(i,s.length())
    {
        if (s[i]!=s[j])
        {
            cout<<"NO";
            return 0;
        }
        j--;
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

#define PI              3.14159265358979323846264338327950
#define pb              push_back
#define mp              make_pair
#define all(a)          (a).begin(), (a).end()
#define clr(a,h)        memset(a, (h), sizeof(a))
#define forn(i, n)      for(int i = 0; i < int(n); ++i)
#define ford(i, n)      for(int i = int(n); i >=0; --i)
#define fore(i, a, b)   for(int i = int(a); i <= int(b); ++i)
#define foreach(it, a)  for(typeof((a).begin()) it=(a).begin(); it != (a).end(); ++it)
#define rforeach(it, a) for(typeof((a).rbegin()) it=(a).rbegin(); it != (a).rend(); ++it)

using namespace std;

const int INF = int(1e9+7);
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef long long       ll;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vii>     vvii;
ifstream fcin("");
ofstream fcout("");
/*  CASOS DE PRUEBA:

*/
/*  RESULTADO:

*/
int main()
{
    string s;
    cin>>s;
    forn(i,s.length())
    {
        if (s[i]!='W' and s[i]!='T' and s[i]!='Y' and s[i]!='U' and s[i]!='I' and s[i]!='O' and s[i]!='A' and s[i]!='H' and s[i]!='H' and s[i]!='V' and s[i]!='M')
        {
            cout<<"NO";
            return 0;
        }
    }
    int j=s.length()-1;
    forn(i,s.length())
    {
        if (s[i]!=s[j])
        {
            cout<<"NO";
            return 0;
        }
        j--;
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

#define PI              3.14159265358979323846264338327950
#define pb              push_back
#define mp              make_pair
#define all(a)          (a).begin(), (a).end()
#define clr(a,h)        memset(a, (h), sizeof(a))
#define forn(i, n)      for(int i = 0; i < int(n); ++i)
#define ford(i, n)      for(int i = int(n); i >=0; --i)
#define fore(i, a, b)   for(int i = int(a); i <= int(b); ++i)
#define foreach(it, a)  for(typeof((a).begin()) it=(a).begin(); it != (a).end(); ++it)
#define rforeach(it, a) for(typeof((a).rbegin()) it=(a).rbegin(); it != (a).rend(); ++it)

using namespace std;

const int INF = int(1e9+7);
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef long long       ll;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vii>     vvii;
ifstream fcin("");
ofstream fcout("");
/*  CASOS DE PRUEBA:

*/
/*  RESULTADO:

*/
int main()
{
    string s;
    cin>>s;
    forn(i,s.length())
    {
        if (s[i]!='W' and s[i]!='T' and s[i]!='Y' and s[i]!='U' and s[i]!='I' and s[i]!='O' and s[i]!='A' and s[i]!='H' and s[i]!='X' and s[i]!='V' and s[i]!='M')
        {
            cout<<"NO";
            return 0;
        }
    }
    //double j=s.length()-1;
    forn(i,s.length())
    {
        if (s[i]!=s[s.length()-1-i])
        {
            cout<<"NO";
            return 0;
        }
        //j--;
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

#define PI              3.14159265358979323846264338327950
#define pb              push_back
#define mp              make_pair
#define all(a)          (a).begin(), (a).end()
#define clr(a,h)        memset(a, (h), sizeof(a))
#define forn(i, n)      for(int i = 0; i < int(n); ++i)
#define ford(i, n)      for(int i = int(n); i >=0; --i)
#define fore(i, a, b)   for(int i = int(a); i <= int(b); ++i)
#define foreach(it, a)  for(typeof((a).begin()) it=(a).begin(); it != (a).end(); ++it)
#define rforeach(it, a) for(typeof((a).rbegin()) it=(a).rbegin(); it != (a).rend(); ++it)

using namespace std;

const int INF = int(1e9+7);
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef long long       ll;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vii>     vvii;
ifstream fcin("");
ofstream fcout("");
/*  CASOS DE PRUEBA:

*/
/*  RESULTADO:

*/
int main()
{
    string s;
    cin>>s;
    forn(i,s.length())
    {
    //LOL me equivoque aqui, puse dos veces la H, que b*ludo xD
        if (s[i]!='W' and s[i]!='T' and s[i]!='Y' and s[i]!='U' and s[i]!='I' and s[i]!='O' and s[i]!='A' and s[i]!='H' and s[i]!='O' and s[i]!='V' and s[i]!='M')
        {
            cout<<"NO";
            return 0;
        }
    }
    //double j=s.length()-1;
    forn(i,s.length())
    {
        if (s[i]!=s[s.length()-1-i])
        {
            cout<<"NO";
            return 0;
        }
        //j--;
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

#define PI              3.14159265358979323846264338327950
#define pb              push_back
#define mp              make_pair
#define all(a)          (a).begin(), (a).end()
#define clr(a,h)        memset(a, (h), sizeof(a))
#define forn(i, n)      for(int i = 0; i < int(n); ++i)
#define ford(i, n)      for(int i = int(n); i >=0; --i)
#define fore(i, a, b)   for(int i = int(a); i <= int(b); ++i)
#define foreach(it, a)  for(typeof((a).begin()) it=(a).begin(); it != (a).end(); ++it)
#define rforeach(it, a) for(typeof((a).rbegin()) it=(a).rbegin(); it != (a).rend(); ++it)

using namespace std;

const int INF = int(1e9+7);
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef long long       ll;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vii>     vvii;
ifstream fcin("");
ofstream fcout("");
/*  CASOS DE PRUEBA:

*/
/*  RESULTADO:

*/
int main()
{
    string s;
    cin>>s;
    forn(i,s.length())
    {
        if (s[i]!='W' and s[i]!='T' and s[i]!='Y' and s[i]!='U' and s[i]!='I' and s[i]!='O' and s[i]!='A' and s[i]!='H' and s[i]!='H' and s[i]!='V' and s[i]!='M')
        {
            cout<<"NO";
            return 0;
        }
    }
    double j=s.length()-1;
    forn(i,s.length())
    {
        if (s[i]!=s[j])
        {
            cout<<"NO";
            return 0;
        }
        j--;
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

#define PI              3.14159265358979323846264338327950
#define pb              push_back
#define mp              make_pair
#define all(a)          (a).begin(), (a).end()
#define clr(a,h)        memset(a, (h), sizeof(a))
#define forn(i, n)      for(int i = 0; i < int(n); ++i)
#define ford(i, n)      for(int i = int(n); i >=0; --i)
#define fore(i, a, b)   for(int i = int(a); i <= int(b); ++i)
#define foreach(it, a)  for(typeof((a).begin()) it=(a).begin(); it != (a).end(); ++it)
#define rforeach(it, a) for(typeof((a).rbegin()) it=(a).rbegin(); it != (a).rend(); ++it)

using namespace std;

const int INF = int(1e9+7);
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef long long       ll;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vii>     vvii;
ifstream fcin("");
ofstream fcout("");
/*  CASOS DE PRUEBA:

*/
/*  RESULTADO:

*/
int main()
{
    string s;
    cin>>s;
    forn(i,s.length())
    {
        if (s[i]!='W' and s[i]!='T' and s[i]!='Y' and s[i]!='U' and s[i]!='I' and s[i]!='O' and s[i]!='A' and s[i]!='H' and s[i]!='H' and s[i]!='V' and s[i]!='M')
        {
            cout<<"NO";
            return 0;
        }
    }
    //double j=s.length()-1;
    forn(i,s.length())
    {
        if (s[i]!=s[s.length()-1-i])
        {
            cout<<"NO";
            return 0;
        }
        //j--;
    }
    cout<<"YES";
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    string s, r = "AHIMOTUVWXY";
    cin>>s;
    int n = s.size(), i;
    if(s.size()==1)
    {
        cout << "NO";
        return 0;
    }
    for(i = 0; i < n; i++)
    {
        if(s[i]!=s[n - i - 1])
        {
            cout << "NO";
            return 0;
        }
        if(r.find(s[i])>r.size())
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int n = s.size(), i;
    if(s.size()==1)
    {
        cout << "NO";
        return 0;
    }
    for(i = 0; i < n; i++)
    {
        if(s[i]!=s[n - i - 1])
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    string s, r = "AHIMOTUVWXY";
    cin>>s;
    int n = s.size(), i;
    for(i = 0; i < n; i++)
    {
        if(s[i]!=s[n - i - 1])
        {
            cout << "NO";
            return 0;
        }
        if(r.find(s[i])>r.size())
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int n = s.size();
    if(s.size()==1)
    {
        cout << "NO";
        return 0;
    }
    for(i = 0; i < n; i++)
    {
        if(s[i]!=s[n - i - 1])
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


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

string s2 = "AHIMOUVWXY";
bool check(char ch)
{
    int flag = 0;
    for(int i=0;i<s2.size();i++)
    {
        if(s2[i]==ch)
        {
            flag = 1;
        }
    }
    if(flag==1)return true;

    return false;
}
int main()
{
    string s,s3;
    int i,j,flag;
    while(cin>>s)
    {
        flag = 0;
        i = 0;
        j = s.size();

        for(i=0;i<j;i++)
        {
            if(!check(s[i]))
            {
                flag = 1;
                break;
            }
        }
        s3 = s;
        reverse(s.begin(),s.end());

        if(flag==0&&s==s3)
        {
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }

    }

return 0;
}


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

string s2 = "AHIMOUTVWXY";
bool check(char ch)
{
    int flag = 0;
    for(int i=0;i<s2.size();i++)
    {
        if(s2[i]==ch)
        {
            flag = 1;
        }
    }
    if(flag==1)return true;

    return false;
}
int main()
{
    string s,s3;
    int i,j,flag;
    while(cin>>s)
    {
        flag = 0;
        i = 0;
        j = s.size();

        for(i=0;i<j;i++)
        {
            if(!check(s[i]))
            {
                flag = 1;
                break;
            }
        }
        s3 = s;
        reverse(s.begin(),s.end());

        if(flag==0&&s==s3)
        {
            printf("YES\n");
        }
        else{
            printf("NO\n");
        }

    }

return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
#define int long long
//#define int unsigned long long

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin>>s;
    int j=s.length()-1;

    int flag=1,flag2=1;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='A' || s[i]=='H' || s[i]=='I' || s[i]=='O' || s[i]=='U' ||s[i]=='V' ||s[i]=='W' ||s[i]=='X' ||s[i]=='Y')
        {
        if(s[i]!=s[j])
        {
            flag=0;
            break;
        }
        else
        {
            j--;
        }
        }
        else
        {
            flag2=0;
            break;
        }

    }

    if(flag==0 || flag2==0)
    cout<<"NO";
    else
    cout<<"YES";
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
#define int long long
//#define int unsigned long long

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin>>s;
    int j=s.length()-1;

    int flag1=1;

    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='A' || s[i]=='H' || s[i]=='I' || s[i]=='O' || s[i]=='U' ||s[i]=='V' ||s[i]=='W' ||s[i]=='X' ||s[i]=='Y' ||s[i]=='T' || s[i]=='M')
        {
             continue;
        }
        else
        {
            flag1=0;
            break;
        }
    }
    //cout<<flag1<<endl;
    if(flag1==0)
    {
        cout<<"NO";
    }
    else
    {
    int flag=1;
    for(int i=0;i<s.length()/2;i++)
    {
        if(s[i]!=s[j])
        {
            flag=0;
            break;
        }
        else
        {
            j--;
        }
    }
    if(flag==0)
    cout<<"NO";
    else
    cout<<"YES";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
#define int long long
//#define int unsigned long long

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin>>s;
    int j=s.length()-1;
    if(s.length()==1)
    {
        cout<<"NO";
    }
    else
    {
    int flag=1;
    for(int i=0;i<s.length()/2;i++)
    {
        if(s[i]!=s[j])
        {
            flag=0;
            break;
        }
        else
        {
            j--;
        }
    }
    if(flag==0)
    cout<<"NO";
    else
    cout<<"YES";
    }
}


#include <bits/stdc++.h>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define FOR(i, n) for(int i = 0; i < n; ++i)
#define clr(x) fill((x).begin(), (x).end(), 0);
#define CLR(x) memset(x, 0, sizeof(x));
#define all(x) (x).begin(), (x).end()
#define vsort(x) sort(all(x))
#define number_of_digits(N) floor(log10(N))+1
#define abc(x) iota(x, x+26, 'a');
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define GCD(x, y) __gcd((x), (y))
#define arraysum(a, n) accumulate(a[0], a[n], 0)
#define print_element(a, i) printf("%lld ", a[i]);
#define print(a) FOR(i, n) printf("%lld ", a[i]); printf("\n");
#define input(a, n) FOR(i, n) cin >> a[i];
#define interaktivni fflush(stdout)

#define vGCD(a, p) ll wrr = a[0]; FOR(i, n) wrr = GCD(r, a[i]); p = wrr;
#define vmin(a, p) ll wrr = a[0]; FOR(i, n) wrr = min(r, a[i]); p = wrr;
#define vmax(a, p) ll wrr = a[0]; FOR(i, n) wrr = max(r, a[i]); p = wrr;

#define MAXN 512345

bitset <MAXN> dp;
ll n, t;
ll a, b;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.length();
    int p = 0;
    int b = 0;
    for(int i = 0; s[i]; ++i){
        if(s[i] == s[n-1-i])p++;
        if(s[i] == 'A' || s[i] == 'H' || s[i] == 'M' || s[i] == 'O' || s[i] == 'I'
        || s[i] == 'U' || s[i] == 'V' || s[i] == 'W' || s[i] == 'X' || s[i] == 'Y') b++;
    }
    //cout << b << " " << p << endl;
    if(p == n && b == n) cout << "YES" << endl;
    else cout << "NO" << endl;
    	//else cout << "YES" << "\n";
    	/*
    	cout << "OVO JE GCD: " << r << endl ;
    	vsort(a);
    	clr(a);*/
//	}

    return 0;
}


#include <bits/stdc++.h>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define FOR(i, n) for(int i = 0; i < n; ++i)
#define clr(x) fill((x).begin(), (x).end(), 0);
#define CLR(x) memset(x, 0, sizeof(x));
#define all(x) (x).begin(), (x).end()
#define vsort(x) sort(all(x))
#define number_of_digits(N) floor(log10(N))+1
#define abc(x) iota(x, x+26, 'a');
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define GCD(x, y) __gcd((x), (y))
#define arraysum(a, n) accumulate(a[0], a[n], 0)
#define print_element(a, i) printf("%lld ", a[i]);
#define print(a) FOR(i, n) printf("%lld ", a[i]); printf("\n");
#define input(a, n) FOR(i, n) cin >> a[i];
#define interaktivni fflush(stdout)

#define vGCD(a, p) ll wrr = a[0]; FOR(i, n) wrr = GCD(r, a[i]); p = wrr;
#define vmin(a, p) ll wrr = a[0]; FOR(i, n) wrr = min(r, a[i]); p = wrr;
#define vmax(a, p) ll wrr = a[0]; FOR(i, n) wrr = max(r, a[i]); p = wrr;

#define MAXN 512345

bitset <MAXN> dp;
ll n, t;
ll a, b;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.length();
    int p = 0;
    for(int i = 0; s[i]; ++i)
        if(s[i] == s[n-1-i])p++;
    //cout <<  p << endl;
    if(p == n && n != 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    	//else cout << "YES" << "\n";
    	/*
    	cout << "OVO JE GCD: " << r << endl ;
    	vsort(a);
    	clr(a);*/
//	}

    return 0;
}


#include <bits/stdc++.h>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define FOR(i, n) for(int i = 0; i < n; ++i)
#define clr(x) fill((x).begin(), (x).end(), 0);
#define CLR(x) memset(x, 0, sizeof(x));
#define all(x) (x).begin(), (x).end()
#define vsort(x) sort(all(x))
#define number_of_digits(N) floor(log10(N))+1
#define abc(x) iota(x, x+26, 'a');
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define GCD(x, y) __gcd((x), (y))
#define arraysum(a, n) accumulate(a[0], a[n], 0)
#define print_element(a, i) printf("%lld ", a[i]);
#define print(a) FOR(i, n) printf("%lld ", a[i]); printf("\n");
#define input(a, n) FOR(i, n) cin >> a[i];
#define interaktivni fflush(stdout)

#define vGCD(a, p) ll wrr = a[0]; FOR(i, n) wrr = GCD(r, a[i]); p = wrr;
#define vmin(a, p) ll wrr = a[0]; FOR(i, n) wrr = min(r, a[i]); p = wrr;
#define vmax(a, p) ll wrr = a[0]; FOR(i, n) wrr = max(r, a[i]); p = wrr;

#define MAXN 512345

bitset <MAXN> dp;
ll n, t;
ll a, b;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.length();
    int p = 0;
    int b = 0;
    for(int i = 0; s[i]; ++i){
        if(s[i] == s[n-1-i])p++;
        if(s[i] == 'A' || s[i] == 'H' || s[i] == 'M' || s[i] == 'O' || s[i] == 'I' || s[i] == 'T'
        || s[i] == 'U' || s[i] == 'V' || s[i] == 'W' || s[i] == 'X' || s[i] == 'Y') b++;
    }
    //cout << b << " " << p << endl;
    if(p == n && b == n) cout << "YES" << endl;
    else cout << "NO" << endl;
    	//else cout << "YES" << "\n";
    	/*
    	cout << "OVO JE GCD: " << r << endl ;
    	vsort(a);
    	clr(a);*/
//	}

    return 0;
}


t=gets.to_i
(1).upto(t) do
  n=gets.to_i
  a=gets.split(' ').map(&:to_i)
  vec = []
  ans = 0
  pos=false
  a.each do |i|
    if vec.empty?
      vec.push(i)
      pos=i>0
      next
    end
    if(i>0 != pos)
      ans+=vec.max
      vec=[i]
      pos = i>0
    else
      vec.push(i)
    end
  end
  ans+=vec.max
  puts ans
end


t=gets.to_i
(1).upto(t) do
  n=gets.to_i
  n>>=1
  if(n&1)==1
    puts "NO"
    next
  end
  puts "YES"
  sum =0
  (1).upto(n) do |i|
    print "#{i*2} "
    sum+=i*2
  end

  (1).upto(n-1) do |i|
    sum-=i*2-1
    print "#{i*2-1} "
  end
  puts sum
end


from sys import stdin, stdout

def main():
	N = int(stdin.readline())
	for tc in range(N):
		n = int(stdin.readline())
		arr = [int(x) for x in stdin.readline().split()]
		minn = float('-inf')
		neg = None
		if arr[0] < 0:
			neg = True
		else:
			neg = False
		res = 0
		for x in arr:
			if x < 0 and neg == False or  x > 0 and neg == True:
				res += minn
				minn = float('-inf')
				if x < 0:
					neg = True
				else:
					neg = False
			if x > minn:
				minn = x
			# print(minn,minn)
		stdout.write(str(res + minn)+'\n')
if __name__ == "__main__":
	main()


'''input
4
5
1 2 3 -1 -2
4
-1 -2 -1 -3
10
-2 8 3 8 -4 -15 5 -2 -3 1
6
1 -1000000000 1 -1000000000 1 -1000000000
'''
from sys import stdin,stdout
I = lambda : map(int,stdin.readline().split())
import bisect
import math
t = input()
for _ in range(t):
	n = input()
	a = I()
	ans = 0;
	nos = []
	i = 0
	if (a[0] > 0):
		sign = 1;
	else:
		sign = 0;
	temp = []
	while (i < n):
		if (sign):
			if (a[i] > 0):
				temp.append(a[i])
			else:
				nos.append(temp)
				sign = 0
				temp = []
				temp.append(a[i])
		else:
			if (a[i] < 0):
				temp.append(a[i])
			else:
				nos.append(temp)
				sign = 1
				temp = []
				temp.append(a[i])
		i+=1
	nos.append(temp)
	for it in nos:
		ans += max(it)
	print ans


from sys import stdin
t = int(stdin.readline())
for _ in xrange(t):
    n = int(stdin.readline())
    a = map(int,stdin.readline().split())
    ans = 0
    b = []
    pr = 1
    if a[0] < 0:
        pr = -1
    for i in a:
        if i * pr <0:
            ans += max(b)
            b = [i]
        else:
            b.append(i)
        pr = i
    ans += max(b)
    print ans


for _ in range(input()):
    n=input()
    a=map(int,raw_input().split())
    pos=0
    sm=0
    curr=0
    s=-100000000000
    l=[]
    fl=0
    for i in a:
        if fl==0:
            if i>0:
                s=max(s,i)
                fl=1

        elif curr==0:
            if i>0:
                s=max(s,i)
            else:
                sm+=s
                l.append(s)
                s=i
                curr=1
        else:
            if i<0:
                s=max(s,i)
            else:
                sm+=s
                l.append(s)
                curr=0
                s=i
    sm+=s

    l.append(s)
    l1=[]
    sm2=0
    curr=1
    s=-100000000000
    fl=0
    for i in a:
        if fl==0:
            if i<0:
                fl=1
                s=max(s,i)

        elif curr==0:
            if i>0:
                s=max(s,i)
            else:
                sm2+=s
                l1.append(s)
                s=i
                curr=1
        else:

            if i<0:
                s=max(s,i)
            else:
                sm2+=s
                l1.append(s)
                curr=0
                s=i
    sm2+=s
    l1.append(s)
    if len(l1)>len(l):
        print sm2
    elif len(l)>len(l1):
        print sm
    else:
        print max(sm,sm2)


    t = input()

    while(t > 0 ):
        n = input()
        array =  [int(n) for n in raw_input().split()]
        value_dp = 0
        max_value = 0
        for i in range(len(array)):
            x = array[i] > 0
            if(i == 0):
                max_value += array[i]
                value_dp = array[i]
            else:
                if(value_dp > 0 ):
                    if( array[i] > value_dp ):
                        max_value += array[i] - value_dp
                        value_dp = array[i]
                    elif( array[i] < 0):
                        max_value += array[i]
                        value_dp = array[i]
                else:
                    if( array[i] > value_dp and array[i] < 0):
                        max_value += array[i] - value_dp
                        value_dp = array[i]
                    elif( array[i] > 0 ):
                        max_value += array[i]
                        value_dp = array[i]
        print(max_value)
        t -= 1


t = input()

while(t > 0 ):
    n = input()
    array =  [int(n) for n in raw_input().split()]
    value_dp = 0
    max_value = 0
    for i in range(len(array)):
        x = array[i] > 0
        if(i == 0):
            max_value += array[i]
            value_dp = array[i]
        else:
            if(value_dp > 0 ):
                if( array[i] > value_dp ):
                    max_value += array[i] - value_dp
                    value_dp = array[i]
                elif( array[i] < 0):
                    max_value += array[i]
                    value_dp = array[i]
            else:
                if( array[i] > value_dp and array[i] < 0):
                    max_value += array[i] - value_dp
                    value_dp = array[i]
                elif( array[i] > 0 ):
                    max_value += array[i]
                    value_dp = array[i]
    print(max_value)
    t -= 1


from sys import stdin,stdout
read,write = stdin.readline,stdout.write
t = int(read())
for i in range(t):
    n = int(read())
    arr = map(int,read().split())

    groups = [[arr[0]]]
    prev = arr[0]
    for elem in arr[1:]:
        if elem >= 0 and prev >= 0 or elem < 0 and prev <0:
            groups[-1].append(elem)
        else:
            groups.append([elem])
        prev = elem

    ans = 0
    for group in groups:
        ans += max(group)
    print(ans)


T = int(raw_input())
for t in range(T):
	raw_input()
	arr = map(int, raw_input().split())
	total = 0
	max_seen = arr[0]
	for a in arr:
		if max_seen * a < 0:
			total += max_seen
			max_seen = a
		if max_seen < a:
			max_seen = a

	print total + max_seen


for _ in range(input()):
    n=input()
    a=[int(i) for i in raw_input().split()]
    s=0
    flag=0
    maxx=-10**18
    for i in range(n):
        if i==0:
            if a[i]<0:
                flag=1
            else:
                flag=0

        elif a[i]<0 and flag==0:
            s+=maxx
            flag=1
            maxx=-10**18
        elif a[i]>0 and flag==1:
            s+=maxx
            flag=0
            maxx=-10**18

        maxx=max(maxx,a[i])
    s+=maxx
    print s


import math
for t in range(input()):
    n=input()
    l=map(int,raw_input().split())
    temp=[l[0]]
    ans=0
    for i in range(1,n):
        if l[i] > 0 and temp[0]>0:
            temp.append(l[i])
        elif l[i]<0 and temp[0]<0:
            temp.append(l[i])
        else:
            ans+=max(temp)
            temp=[l[i]]
    ans+=max(temp)
    print ans


def s(ar):
    x=0
    for i in range(len(ar)):
        x+=ar[i]
    return x

t=int(raw_input())
ans=[]
for i in range(t):
    n=int(raw_input())
    ar=map(int,raw_input().split())
    x=[]
    mi=[]
    ma=[]
    for j in range(len(ar)):
        if ar[j]>=0:
            ma.append(ar[j])
            if len(mi)!=0:
                x.append(max(mi))
                mi=[]
        else:
            mi.append(ar[j])
            if len(ma)!=0:
                x.append(max(ma))
                ma=[]
    if len(mi)!=0:
      x.append(max(mi))
    if len(ma)!=0:
      x.append(max(ma))
    ans.append(x)
for i in range(len(ans)):
    print s(ans[i])


def s(ar):
    x=0
    for i in range(len(ar)):
        x+=ar[i]
    return x

t=int(raw_input())
ans=[]
for i in range(t):
    n=int(raw_input())
    ar=map(int,raw_input().split())
    x=[]
    mi=[]
    ma=[]
    for j in range(len(ar)):
        if ar[j]>=0:
            ma.append(ar[j])
            if len(mi)!=0:
                x.append(max(mi))
                mi=[]
        else:
            mi.append(ar[j])
            if len(ma)!=0:
                x.append(max(ma))
                ma=[]
    if len(mi)!=0:
      x.append(max(mi))
    if len(ma)!=0:
      x.append(max(ma))
    ans.append(x)
print ans
for i in range(len(ans)):
    print s(ans[i])


import sys

t=int(raw_input())
for i in range(t):
    n= int(raw_input())
    l= map(int, sys.stdin.readline().split(' '))

    if l[0]>0:
        f=1
    else:
        f=-1
    p=0
    n=0
    a=[]
    for i in range(len(l)):
        if l[i]>0 and f==1:
            if l[i]>p:
                p=l[i]
            continue
        elif l[i]>0 and f==-1:
            a.append(n)
            n=0
            f=1
            p=l[i]
            continue
        elif l[i]<0 and f==-1:
            if n==0:
                n=l[i]
            elif l[i]>n:
                n=l[i]
            continue
        elif l[i]<0 and f==1:
            a.append(p)
            p=0
            f=-1
            n=l[i]
            continue
    if f==1:
        a.append(p)
    else:
        a.append(n)
    print sum(a)


t = input()
while t > 0:
    t -= 1
    n = input()
    a = map(int, raw_input().split())
    sum = 0
    last = a[0]
    accepted = 0
    ans = 0
    for i in range(1, n):
        curr = a[i]
        if ans == 0:
            if last > 0:
                if curr > 0:
                    last = max(last, curr)
                else:
                    # print last
                    accepted += last
                    last = curr
            else:
                if curr < 0:
                    last = max(last, curr)
                else:
                    # print last
                    accepted += last
                    last = curr
    min_ = a[n-1]
    for i in range(n-2, -1, -1):
        curr = a[i]
        if min_ * curr < 0:
            break
        else:
            min_ = max(min_, curr)

    print accepted + min_


def sol(n,A):
    p1,p2,result,maxx = 0,0,0,-10**9
    while p2<n:
        if A[p1]*A[p2] < 0:
            p1 = p2
            result += maxx
            maxx = -10**9
        else:
            maxx = max(maxx, A[p2])
            p2 += 1
    return result+maxx

t = int(raw_input())
for i in xrange(t):
    n = int(raw_input())
    A = map(int, raw_input().split())
    print sol(n,A)


def ret(n):
    return (n*(n+1))/2
for _ in range(input()):
    n=input()
    l=map(int,raw_input().split())
    if l[-1]>0:
        l.append(-1)
    else:
        l.append(1)
    s=0
    mx=l[0]
    i=1
    while i<=n:
        #print mx,l[i]
        if l[i-1]>0 and l[i]>0:
            mx=max(mx,l[i])
        elif (l[i-1]>0 and l[i]<0) or (l[i-1]<0 and l[i]>0):
            s+=mx
            mx=l[i]
            #print mx,
        else:
            mx=max(mx,l[i])
        i+=1
    print s


for _ in range(input()):
    n = input()
    a = map(int,raw_input().split())
    ans = [a[0]]
    for i in range(1,n):
        if ans[-1]<0 and a[i]<0:
            ans[-1] = max(ans[-1], a[i])
        elif ans[-1]>0 and a[i]>0:
            ans[-1] = max(ans[-1], a[i])
        else:
            ans.append(a[i])

    print sum(ans)


t= input('')
for x in range(t):

    n= input('')
    a= map(int,raw_input('').split(' '))
    index=0
    if a[0]>=0:
        curr='e'
    else:
        curr='o'
    k=0
    sum1=0
    while(index<n):
        if curr=='e':
            if a[index]>=0:
                k+=1

                max1=a[index]
                index+=1
                while(index<n and a[index]>=0):
                    max1=max(max1,a[index])
                    index+=1

                sum1+=max1
                curr='o'

        else:
            if a[index]<0:
                k+=1

                max1=a[index]
                index+=1
                while(index<n and a[index]<0):
                    if a[index]>max1:
                        max1= a[index]
                    index+=1

                sum1+=max1
                curr='e'

    print  sum1


#!python2

def arr_in():
    return [int(i) for i in raw_input().split()]

T = input()
while T:
    T -= 1
    n = input()
    s, prev, ms = 0, 0, 0
    A = arr_in()
    for a in A:
        if (a < 0 and prev < 0) or (a > 0 and prev > 0):
            ms = max(ms, a)
            prev = a
            flag = 1
        else:
            s += ms
            prev = a
            ms = a
    s += ms
    print s


n=int(input())
def sign(a):
	return 1 if int(a)>0 else -1

for i in range(n):
	a=int(input())
	arr=raw_input()
	arr=arr.split()
	outer=0
	inner=0
	total=0
	s=sign(arr[0])
	while(outer<len(arr)):
		inner=outer
		m=int(arr[inner])
		while(inner<len(arr) and s==sign(arr[inner])):
			m=max(m,int(arr[inner]))
			inner+=1
		total+=m
		s*=(-1)
		outer=inner
	print(total)


for _ in xrange(int(raw_input())):
    n = input()
    a = map(int, raw_input().split())
    res = []
    cur = [a[0]]
    cs = a[0] / abs(a[0])
    for i in range(1, n):
        if a[i] / abs(a[i]) == cs:
            cur.append(a[i])
        else:
            res.append(max(cur))
            cur = [a[i]]
            cs = a[i] / abs(a[i])
    res.append(max(cur))
    print sum(res)


#include<stdio.h>
#include<limits.h>
int main()
{
	long long int T;
	scanf("%lld",&T);
	while(T--)
	{
		long long int n,localmin=INT_MIN,localmax=0,sum=0;
		scanf("%lld",&n);
		long long int a[n];
		for (long long int i = 0; i < n; ++i)
		{
			scanf("%lld",&a[i]);
		}
		if (n==1)
		{
			printf("%lld\n",a[0]);
			continue;
		}
		if(a[0]>0)
		{
			localmax=a[0];
		}
		else
		{
			localmin=a[0];
		}
		long long int i = 1;
		while(i<n)
		{
			if((((a[i-1]*a[i])<0)) && a[i]>0)
			{
				sum += localmin;
				localmin=INT_MIN;
			}
			if ((((a[i-1]*a[i])<0)) && a[i]<0)
			{
				sum += localmax;
				localmax=0;
			}
			if(a[i]>0)
			{
				if (a[i]>localmax)
				{
					localmax = a[i];
					i++;
				}
				else
				{
					i++;
					//continue;
				}
			}
			else
			{
				if (a[i]>localmin)
				{
					localmin = a[i];
					i++;
					//continue;
				}
				else
				{
					i++;
					//continue;
				}
			}
			if(i==n)
			{
				if(localmax!=0)
					sum += localmax;
				else
					sum +=localmin;
			}
			//printf("%lld\n",i);

		}
		printf("%lld\n",sum);
	}
}


#include<stdio.h>
#include<limits.h>
int main()
{
	long long int T;
	scanf("%lld",&T);
	while(T--)
	{
		long long int n,localmin=INT_MIN,localmax=0,sum=0;
		scanf("%lld",&n);
		long long int a[n];
		for (long long int i = 0; i < n; ++i)
		{
			scanf("%lld",&a[i]);
		}
		if(a[0]>0)
			localmax=a[0];
		else
			localmin=a[0];
		long long int i = 1;
		while(i<n)
		{
			if((((a[i-1]*a[i])<0)) && a[i]>0)
			{
				sum += localmin;
				localmin=INT_MIN;
			}
			if ((((a[i-1]*a[i])<0)) && a[i]<0)
			{
				sum += localmax;
				localmax=0;
			}
			if(a[i]>0)
			{
				if (a[i]>localmax)
				{
					localmax = a[i];
					i++;
				}
				else
				{
					i++;
					//continue;
				}
			}
			else
			{
				if (a[i]>localmin)
				{
					localmin = a[i];
					i++;
					//continue;
				}
				else
				{
					i++;
					//continue;
				}
			}
			if(i==n)
			{
				if(localmax!=0)
					sum += localmax;
				else
					sum +=localmin;
			}
			//printf("%lld\n",i);

		}
		printf("%lld\n",sum);
	}
}


#include<stdio.h>
#include<limits.h>
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		long int n,localmin=INT_MIN,localmax=0,sum=0;
		scanf("%ld",&n);
		long int a[n];
		for (int i = 0; i < n; ++i)
		{
			scanf("%ld",&a[i]);
		}
		if(a[0]>0)
			localmax=a[0];
		else
			localmin=a[0];
		long int i = 1;
		while(i<n)
		{
			if((((a[i-1]*a[i])<0)) && a[i]>0)
			{
				sum += localmin;
				localmin=INT_MIN;
			}
			if ((((a[i-1]*a[i])<0)) && a[i]<0)
			{
				sum += localmax;
				localmax=0;
			}
			if(a[i]>0)
			{
				if (a[i]>localmax)
				{
					localmax = a[i];
					i++;
				}
				else
				{
					i++;
					//continue;
				}
			}
			else
			{
				if (a[i]>localmin)
				{
					localmin = a[i];
					i++;
					//continue;
				}
				else
				{
					i++;
					//continue;
				}
			}
			if(i==n)
			{
				if(localmax!=0)
					sum += localmax;
				else
					sum +=localmin;
			}
			//printf("%ld\n",i);

		}
		printf("%ld\n",sum);
	}
}


#include <stdio.h>

int main()
{
	int tc;
	scanf("%d",&tc);
	while(tc--){
		long long n;
		scanf("%lld",&n);
		long long i,max,a[n],sum;
		for(i=0;i<n;i++)
			scanf("%lld",&a[i]);
		max=a[0],sum=max;
		for(i=1;i<n;i++){
			if(a[i]>0&&a[i-1]>0){
				if(a[i]>max){
					sum-=max;max=a[i];sum+=max;}
		}
			else if(a[i]<0&&a[i-1]<0){
				if(a[i]>max){
					sum-=max;max=a[i];sum+=max;}
			}
			else{
				sum+=a[i];
				max=a[i];
			}
		}
		printf("%lld\n",sum);
	}
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
        {
            long long n,i,temp=0,last=0;
            long long cnt=0;
            scanf("%lld",&n);
            scanf("%lld",&temp);
            last=temp;
            for(i=1;i<n;i++)
            {
                scanf("%lld",&temp);
                if(temp*last<0)
                {
                    cnt+=last;
                    last=temp;
                    if(i==n-1)
                    cnt+=temp;
                }
                else
                {
                    if(temp>last)
                        last=temp;
                    if(i==n-1)
                        cnt+=last;
                }
            }
            printf("%lld\n",cnt);

        }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
        {
            long long n,i,temp=0,last=0;
            long long cnt=0;
            scanf("%lld",&n);
            scanf("%lld",&temp);
            last=temp;
            if(n==1)
                cnt=temp;
            for(i=1;i<n;i++)
            {
                scanf("%lld",&temp);
                if(temp*last<0)
                {
                    cnt+=last;
                    last=temp;
                    if(i==n-1)
                    cnt+=temp;
                }
                else
                {
                    if(temp>last)
                        last=temp;
                    if(i==n-1)
                        cnt+=last;
                }
            }
            printf("%lld\n",cnt);

        }
    return 0;
}


#include<stdio.h>
int main(){
	int time,i,n,j,x=0;
	long long int num=0;
	scanf("%d",&time);
	for(int k=0;k<time;k++){
		scanf("%d",&n);
		long long int a[n];
		for(j=0;j<n;j++){
			scanf("%lld",&a[j]);
		}
		j=0;i=1;x=a[0];num=0;
		while(i<n){
			if(a[j]*a[i]>0){
				if(a[i]>x){
					x=a[i];
				}
			}
			if(a[j]*a[i]<0){
				num=num+x;
				x=a[i];
			}
			i++;j++;
		}
		num=num+x;
		printf("%lld\n",num);
	}
}


#include<stdio.h>
int main(){
	int time,i,n,j,x=0;
	long long int num=0;
	scanf("%d",&time);
	for(int k=0;k<time;k++){
		scanf("%d",&n);
		int a[n];
		for(j=0;j<n;j++){
			scanf("%d",&a[j]);
		}
		j=0;i=1;x=a[0];num=0;
		while(i<n){
			if(a[j]*a[i]>0){
				if(a[i]>x){
					x=a[i];
				}
			}
			if(a[j]*a[i]<0){
				num=num+x;
				x=a[i];
			}
			i++;j++;
		}
		num=num+x;
		printf("%lld\n",num);
	}
}


#include<stdio.h>
int check_positive(long a)
{
    if(a>0)
    return 1;
    else
    return 0;
}

int main()
{
    long n,i,j;
    scanf("%ld\n",&n);
    long a,b,c,k,sum[n];
    for(i=0;i<n;i++)
    {
        scanf("%ld\n",&a);
        long arr[a];
        scanf("%ld ",&arr[0]);
        k=arr[0];
        b=check_positive(k);
        sum[i]=k;
        for(j=1;j<a;j++)
        {
            scanf("%ld ",&arr[j]);
            c=check_positive(arr[j]);
            if(b!=c)
            {
                k=arr[j];
                sum[i] +=k;
            }
            if( (b==c) && (arr[j]>k) )
            {
                sum[i] +=arr[j] - k;
                k=arr[j];
            }
            b=c;
        }
        printf("%ld\n",sum[i]);
    }
    return 0;
}


#include<stdio.h>
int check_positive(long a)
{
    if(a>0)
    return 1;
    else
    return 0;
}

int main()
{
    long n,i,j;
    scanf("%ld\n",&n);
    long a,b,c,k,sum[n];
    for(i=0;i<n;i++)
    {
        scanf("%ld\n",&a);
        long arr[a];
        scanf("%ld ",&arr[0]);
        k=arr[0];
        b=check_positive(k);
        sum[i]=arr[0];
        for(j=1;j<a;j++)
        {
            scanf("%ld ",&arr[j]);
            c=check_positive(arr[j]);
            if(b!=c)
            {
                k=arr[j];
                sum[i] +=k;
            }
            if( (b==c) && (arr[j]>arr[j-1]) )
            {
                sum[i] +=arr[j] - k;
                k=arr[j];
            }
            b=c;
        }
        printf("%ld\n",sum[i]);
    }
    return 0;
}


#include<stdio.h>
int check_positive(long long a)
{
    if(a>0)
    return 1;
    else
    return 0;
}

int main()
{
    long long n,i,j;
    scanf("%lld\n",&n);
    long long a,b,c,k,sum[n];
    for(i=0;i<n;i++)
    {
        scanf("%lld\n",&a);
        long long arr[a];
        scanf("%lld ",&arr[0]);
        k=arr[0];
        b=check_positive(k);
        sum[i]=k;
        for(j=1;j<a;j++)
        {
            scanf("%lld ",&arr[j]);
            c=check_positive(arr[j]);
            if(b!=c)
            {
                k=arr[j];
                sum[i] +=k;
            }
            if( (b==c) && (arr[j]>k) )
            {
                sum[i] +=arr[j] - k;
                k=arr[j];
            }
            b=c;
        }
        printf("%lld\n",sum[i]);
    }
    return 0;
}


#include<stdio.h>

int main()
{
   int t,n,i;
   scanf("%d",&t);
   while(t--)
   {
       scanf("%d",&n);
       int arr[n+1];
       int pmax=0,nmax=0,flag=0;
       long long int ans=0;
       for(i=1;i<=n;i++)
       {
           scanf("%d",&arr[i]);
           if(flag==0)
          { if(arr[i]<0) { nmax=arr[i]; flag=1; } }
       }
        arr[0]=0;
       for(i=1;i<=n;i++)
       {
           if(arr[i]>0) {if(arr[i]>=pmax) pmax=arr[i]; if(arr[i+1]<0) {ans+=pmax; nmax=arr[i+1]; } }
           else
           {
              if(arr[i]>=nmax) { nmax=arr[i]; }
              if(arr[i+1]>0 ) { ans+=nmax; pmax=0; }
           }

       }
       if(arr[n]<0) ans+=nmax;
       else ans+=pmax;

       printf("%lld\n",ans);
   }

    return 0;
}


#include<stdio.h>

int main()
{
   int t,n,i;
   scanf("%d",&t);
   while(t--)
   {
       scanf("%d",&n);
       int arr[n+1];
       int pmax=0,nmax=0,flag=0;
       long long int ans=0;
       for(i=1;i<=n;i++)
       {
           scanf("%d",&arr[i]);
           if(flag==0)
          { if(arr[i]<0) { nmax=arr[i]; flag=1; } }
       }
        arr[0]=0; arr[n+1]=0;
       for(i=1;i<=n;i++)
       {
           if(arr[i]>0) {if(arr[i]>=pmax) { pmax=arr[i];  }
                          if(arr[i+1]<0) {ans+=pmax; nmax=arr[i+1]; } }
           else
           {
              if(arr[i]>=nmax) { nmax=arr[i]; }
              if(arr[i+1]>0 ) { ans+=nmax; pmax=0; }
           }

       }
       if(arr[n]<0) ans+=nmax;
       else ans+=pmax;

       printf("%lld\n",ans);
   }

    return 0;
}


#include <stdio.h>

int main(void) {
	long long int t,n,i,a[200000],sum=0,neg=0,pos=0,flag=0;
	scanf("%lld",&t);
	while(t--){
	    sum=0;
	    pos=0;
	    neg=0;
	    scanf("%lld",&n);
	    for(i=0;i<n;i++){
	        scanf("%lld",&a[i]);
	    }
	    if(a[0]<0){
	        flag=0;
	        neg=a[0];
	    }
	    else{
	        flag=1;
	        pos=a[0];
	    }
	    for(i=1;i<n;i++){
	        if(a[i]<0){
	            if(flag==0){
	                if(neg<a[i]){
	                    neg=a[i];
	                    pos=0;
	                }
	            }
	            else{
	                neg=a[i];
	                sum+=pos;
	                pos=0;
	                flag=0;
	            }
	        }
	            else{
	                if(flag==0){
	                    pos=a[i];
	                    sum+=neg;
	                    neg=0;
	                    flag=1;
	                }
	                else{
	                    if(pos<a[i]){
	                        pos=a[i];
	                        neg=0;
	                    }
	                }
	            }
	    }
	    sum+=pos+neg;
	    printf("%lld\n",sum);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
	long int data;
	struct node *next;
}NODE;

NODE *createNode(long int data)
{
    NODE *temp = (NODE *)malloc(sizeof(NODE));
    temp->data = data;
    temp->next = NULL;
    return temp;
}
int checkSigns(long int num1,long int num2)
{
    if((num1 > 0) && (num2 >0))
    return 1;
    if((num1 < 0) && (num2 < 0))
    return 2;
    return 3;
}
void addNode(NODE *prev, NODE *current, NODE *head, long int num)
{
    NODE *temp = current;
    if(prev == NULL)
    {
        free(temp);
        head = createNode(num);
        current = head;
    }
    else
    {
        current = createNode(num);
        prev->next = current;
        prev = current;
        free(temp);
    }
}
long long int printAns(NODE *head)
{
    long long int ans = 0;
    NODE *temp;
    while(head != NULL)
    {
        temp = head;
        ans+= head->data;
        head = head->next;
        free(temp);
    }
    return ans;
}
int main() {
	int t;
	scanf("%d",&t);
	while(t--)
	{
		NODE *head = NULL, *current, *temp, *prev = NULL;
		int n;
		long int num;
        long int maxValue;
		scanf("%d",&n);
		while(n--)
		{
			scanf("%ld", &num);
			if(head == NULL)
			{
				head = createNode(num);
				current = head;
			}
			else
			{
				int retValue = checkSigns(num, current->data);
				maxValue = current->data;
                if(retValue == 1)
				{
                    if(num > maxValue)
                        addNode(prev, current, head, num);
                }
                else if(retValue == 2)
                {
                    if(num > maxValue)
                        addNode(prev, current, head, num);
                }
                else
                {
                    current->next = createNode(num);
                    prev = current;
                    current = current->next;
                }
			}
		}
        printf("%lld\n",printAns(head));
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
	long int data;
	struct node *next;
}NODE;

NODE *createNode(long int data)
{
    NODE *temp = (NODE *)malloc(sizeof(NODE));
    temp->data = data;
    temp->next = NULL;
    return temp;
}
int checkSigns(long int num1,long int num2)
{
    if((num1 > 0) && (num2 >0))
    return 1;
    if((num1 < 0) && (num2 < 0))
    return 2;
    return 3;
}
long long int printAns(NODE *head)
{
    long long int ans = 0;
    NODE *temp;
    while(head != NULL)
    {
        temp = head;
        ans+= head->data;
        head = head->next;
        free(temp);
    }
    return ans;
}
int main() {
	int t;
	scanf("%d",&t);
	while(t--)
	{
		NODE *head = NULL, *current, *temp, *prev = NULL;
		int n;
		long int num;
        long int maxValue;
		scanf("%d",&n);
		while(n--)
		{
			scanf("%ld", &num);
			if(head == NULL)
			{
				head = createNode(num);
				current = head;
			}
			else
			{
				int retValue = checkSigns(num, current->data);
				maxValue = current->data;
                if(retValue == 1 || retValue == 2)
				{
                    if(num > maxValue)
                        current->data = num;
                }
                else
                {
                    current->next = createNode(num);
                    current = current->next;
                }
			}
		}
        printf("%lld\n",printAns(head));
	}
	return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main(){
	long long T;
	scanf("%lld", &T);
	while (T--) {
		long long n ;
		scanf("%lld",&n);
		long long arr[n];
		for(long long i = 0 ; i< n ; i++)
			scanf("%lld",&arr[i]);
		long long max = arr[0]  ;
		long long sum = 0 ;
		long long sign ;
		long long fine  ;
		if(arr[0]>0)
			sign = 1 ;
		else if(arr[0]<0)
			sign = 0 ;

		for(long long i = 1; i<n ; i++){
				if(arr[i]>0)
					fine =1 ;
				else if (arr[i]<0)
					fine = 0 ;
				else fine = sign ;

				if(fine != sign){
					sum = sum +max ;

					max = arr[i] ;
					if(i==n-1)
						sum = sum + max ;

				}
				else{
					max = max>arr[i]?max:arr[i];
					if(i==n-1)
						sum = sum + max ;
				}

				sign = fine ;
			}
			if(n==1)
				sum = max ;
		printf("%lld\n",sum);

	}
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main(){
	long long T;
	scanf("%lld", &T);
	while (T--) {
		long long n ;
		scanf("%lld",&n);
		long long arr[n];
		for(long long i = 0 ; i< n ; i++)
			scanf("%lld",&arr[i]);
		long long max = arr[0]  ;
		long long sum = 0 ;
		long long sign ;
		long long fine  ;
		if(arr[0]>0)
			sign = 1 ;
		else if(arr[0]<0)
			sign = 0 ;

		for(long long i = 1; i<n ; i++){
				if(arr[i]>0)
					fine =1 ;
				else if (arr[i]<0)
					fine = 0 ;
				else fine = sign ;

				if(fine != sign){
					sum = sum +max ;

					max = arr[i] ;
					if(i==n-1)
						sum = sum + max ;

				}
				else{
					max = max>arr[i]?max:arr[i];
					if(i==n-1)
						sum = sum + max ;
				}

				sign = fine ;
			}
		printf("%lld\n",sum);

	}
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdbool.h>

bool bigyo(int x, int y)
{
	if (x > 0 && y < 0)
		return true;
	else if (x < 0 && y > 0)
		return true;
	else
		return false;
}

int bigyo2(int x, int y)
{
	if (x > y)
		return x;
	else
		return y;
}

long long updown(int* a)
{
	int temp;
	long long result = 0;
	bool b = true;

	for (int i = 0; i < _msize(a) / sizeof(int); i++)
	{
		if (i == 0)
			temp = a[i];

		if (i != _msize(a) / sizeof(int) - 1)
		{
			b = bigyo(a[i], a[i + 1]);
			switch (b)
			{
			case 0:
				temp = bigyo2(temp, a[i + 1]);
				break;
			case 1:
				result += temp;
				temp = a[i + 1];
				break;
			}
		}
		else
			result += temp;

	}
	return result;
}

int main()
{
	int t, n, num;
	int* a;
	long long* arr;

	scanf("%d", &t);
	arr = malloc(sizeof(long long) * t);

	for (int i = 0; i < t; i++)
	{
		scanf("%d", &n);
		a = malloc(sizeof(int) * n);

		for (int j = 0; j < n; j++)
		{
			scanf("%d", &num);
			a[j] = num;

		}

		arr[i] = updown(a);

		free(a);
	}

	for (int i = 0; i < t; i++)
		printf("%lld\n", arr[i]);

	free(arr);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdbool.h>

bool bigyo(int x, int y)
{
	if (x > 0 && y < 0)
		return true;
	else if (x < 0 && y > 0)
		return true;
	else
		return false;
}

int bigyo2(int x, int y)
{
	if (x > y)
		return x;
	else
		return y;
}

long long updown(int* a)
{
	int temp;
	long long result = 0;
	bool b = true;

	for (int i = 0; i < _msize(a) / sizeof(int); i++)
	{
		if (i == 0)
			temp = a[i];

		if (i != _msize(a) / sizeof(int) - 1)
		{
			b = bigyo(a[i], a[i + 1]);
			switch (b)
			{
			case 0:
				temp = bigyo2(a[i], a[i + 1]);
				break;
			case 1:
				result += temp;
				temp = a[i + 1];
				break;
			}
		}
		else
			result += temp;

	}
	return result;
}

int main()
{
	int t, n, num;
	int* a;
	long long* arr;

	scanf("%d", &t);
	arr = malloc(sizeof(long long) * t);

	for (int i = 0; i < t; i++)
	{
		scanf("%d", &n);
		a = malloc(sizeof(int) * n);

		for (int j = 0; j < n; j++)
		{
			scanf("%d", &num);
			a[j] = num;

		}

		arr[i] = updown(a);

		free(a);
	}

	for (int i = 0; i < t; i++)
		printf("%lld\n", arr[i]);

	free(arr);
	return 0;
}


#include<stdio.h>
int main(){
	int t=0;
	 scanf("%d",&t);
	 while(t--){
	 	int size=0;
	 	int curr_length=0;
	 	int maxLength=0;
	 	long long int sum=0;
	 	long long int maxSum=-99999999999;
	 	scanf("%d",&size);
	 	long long int arr[size];
	 	for(int i=0;i<size;i++){
	 		scanf("%lld",&arr[i]);
	 	}

	 	for(int i=0;i<=size-1;i++){
	 		curr_length=0;

	 		sum=arr[i];
	 		int j=i;
	 		int k=j+1;
	 		while(k<size){
	 			if(arr[k]*arr[j]<0){
	 				if(k<size-1){
	 					int p=k+1;
	 					while(arr[p]*arr[k]>0 && p<size){
	 						if(arr[p]>=arr[k]){
	 							k=p;
	 						}
	 						p++;
	 					}
	 				}

	 				curr_length++;
	 				sum=sum+arr[k];
	 				j=k;
	 			}
	 			k++;
	 		}
	 		if(curr_length>maxLength){
	 			maxLength=curr_length;
	 			maxSum=sum;
	 		}
	 		if(curr_length==maxLength){
	 			if(sum>maxSum){
	 				maxSum=sum;
	 			}
	 		}

	 	}
	 	printf("%lld\n",maxSum);

	 }
}


#include<stdio.h>
int main(){
	int t=0;
	 scanf("%d",&t);
	 while(t--){
	 	int size=0;
	 	long long int sum=0;
	 	scanf("%d",&size);
	 	long long int arr[size];
	 	for(int i=1;i<=size;i++){
	 		scanf("%lld",&arr[i]);
	 	}

	    arr[0] = -arr[1];

 		int j=0;
 		int k=1;
 		while(k<=size){
 			if(arr[k]*arr[j]<0){
 				if(k<=size-1){
 					int p=k+1;
 					while(arr[p]*arr[k]>0 && p<=size){
 						if(arr[p]>=arr[k]){
 							k=p;
 						}
 						p++;
 					}
 				}

 				sum=sum+arr[k];
 				j=k;
 			}
 			k++;
 		}
	 	printf("%lld\n",sum);

	 }
}


#include<stdio.h>
int main( )
{
    int n;
    scanf("%d",&n);
    while(n--){
        long long sum=0,max,a,i,j,k,l,b;
        scanf("%lld",&a);
        long long w[a];
        for(i=0;i<a;i++){
            scanf("%lld",&w[i]);
        }
        for(i=0;i<a; ){
            max=w[i];
            for(j=i+1;j<a;j++){
                if(w[i]*w[j]>0){
                    if(w[j]>max){
                        max=w[j];
                    }
                }
                else{
                    i=j;
                    break;
                }
            }
            sum+=max;
            if(j==a)
                break;
        }
        printf("%lld\n",sum);
    }
    return 0;
}