#include <iostream>
using namespace std;
class TextProcessor {
    public:
    // static int count; //static variable
    // static function to convert to uppercase
    static void process(string str){
        bool valid = true;
        //check if string contain only alphabets
        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){
            // convert to uppercase
            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;
            
        }
    }
};
//definifation of static variale 
int textProcessor::count=0;
int main(){
    int n;
    cin>>n;
    string =str;
    for (int i=0; i<n; i++){
        cin>>str;
        TextProcessor::processor(str);
    }
    return 0;
}