#include<iostream>
using namespace std;

 class Textprocessor
 {
     public: 
     
     static void processor(string str)
     {
         bool vaild=true; 
         
         for(int i=0;i<str.length();i++)
         {
             if(!(str[i]>='a'&&str[i]<='z')||(str[i]>='a'&& str[i]<='z'))) 
             {
                valid = flase;
                break;
             }
         }
            if(valid)
         {
           for(int i = 0; i < str.length();i++)
           {
             if(str[i]>='a'&&  str[i]<='z')
             {
                 str[i]=str[i]-32;
             }
           }  
           cout<<str<<endl;
           //count++;
         }else
         {
             cout << "Invalid input"<< endl;
         }
         
     }
 };
 
 int main()
 {
     int n;
     cin >> n; 
     
     string str;
     for(int i = 0; i < n; i++)
     {
         cin>>str;
         TextProcessor::process(str);
     }
     return 0;
 }