#include<iostream>
#include<string>
using namespace std;

class Textprocessor {
public:
    static int count;
    static void process(string str){
        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++){
                if (str[i] >= 'a' && str[i] <='z') {
                    str[i] = str[i] -32;
                }
            }
            cout <<str << endl;
            count++;
        }
        else{
            cout <<"Ivalid input" << endl;
        }
        
    }    
            
};

int Textprocessor::count=0;

int main(){
    int n;
    cin>> n;
    
    string str;
    
    for (int i=0; i< n) i++){
        cin >> str;
        Textprocessor::process(str);
    }
    return 0;
}