#include<iostream>
#include<string>
#include<cctype>
using namespace std;
class TextProcessor
{
    public:
    static int count;
    static void process(string s)
    {
        for(char c : s)
        {
            if(!isalpha(c))
            {
                cout<<"Invalid input"<<endl;
                return;
            }
        }
        for (char &c : s)c=toupper(c);
        cout<<s<<endl;
        Count++;
    }
};
int TextProcessor::count = 0;
int main()
{
    int n;
    if(!(cin>>n))return 0;
    while(n--)
        {
            string str;
            cin>>str;
            TextProcessor::process(str);
        }
return 0;
}