#include <iostream>
using namespace std;
int main()
{
int n;
string s;
cin >> n;
while (n--)
{
cin >> s;
if (s[0] >= 97 && s[0] <= 122)
s[0] -= 32;
for (int i = 1; s[i]; i++)
if (s[i] >= 65 && s[i] <= 90)
s[i] += 32;
cout << s << endl;
}
return 0;
}