#include <bits/stdc++.h>
using namespace std;
int main() {
int n;cin>>n;
vector<string>v;
while(n--){
int k=1;
string temp;
cin>>temp;
v.push_back(temp);
for(auto a = v.rbegin();a!=v.rend();a++)
if(k<5)
cout<<k++<<"="<<*a<<" ";
cout<<endl;
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号