#include<iostream>
#include<string>
#include<cctype>
using namespace std;
class textprocessor{
    private:
    static int count ;
    public:
    static void converttoupper(string str) {
        if(str.empty())return;
        bool valid =true;
        for (int i=0; i < str.length(); i++){
            if(!((str[i]>='a'&& str[i]<='z')||(str[i]>='A'&& str[i]<='Z')) {
            valid =false;
            break;
        }
    }
    if(valid){
        for(int i=0;i<str.length();i++){
            str[i]=toupper(static_cast<unsigned char>(str[i]));
        }
        cout<<str<<"\n";
        count++;
    }
    else{
        cout<<"Invalid input";
    }
}};
        int textprocessor::count=0;
        int main()
        {
            int n;
            if(!(cin>>n)) return 0;
            
            cin.ignore(1000,'\n');
            string str;
            for (int i=0;i<n;i++){
                getline(cin,str);
                textprocessor::converttoupper(str);
            }
            return 0;
        }