#include<iostream>
#include<string>
using namespace std;
class solution
{
public:
void solve()
{
string s;
cin >> s;
for (int i = 0; i < s.length(); i++)
{
if (s[i] == 'p' && s[i+1] == 'a' && s[i+2] == 'r' && s[i+3] == 't' && s[i+4] == 'y')
{
s[i + 0] = 'p';
s[i + 1] = 'a';
s[i + 2] = 'w';
s[i + 3] = 'r';
s[i + 4] = 'i';
}
}
cout << s << "
";
}
};
int main()
{
solution ss;
int t;
cin >> t;
while (t--)
{
ss.solve();
}
return 0;
}