#include using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; } bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; } void solve() { int K; string S; cin >> K >> S; if(K >= ssize(S) - 1) cout << string(ssize(S), S.front()) << endl; else cout << string(K, S.front()) + S.substr(0, ssize(S) - K) << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--) solve(); }