#include using namespace std; int main() { int T; cin >> T; while (T--) { int K; string S; cin >> K >> S; if (K >= S.size()) { cout << string(S.size(), S[0]) << endl; } else { cout << string(K, S[0]) << S.substr(0, S.size() - K) << endl; } } return 0; }