// editor1
#include<iostream>
using namespace std;
int main()
{
    string n,m;
    cin<<n<<m;
    if(isupper(n&m))
    {
        cout<<n<<endl;
        cout<<m;
    }
    else
    {
        cout<<"Invalid input";
    }
}