#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, K;
  cin >> N >> K;
  string S, U, T;
  cin >> S;
  T = S;
  reverse(T.begin(), T.end());
  cout << T << endl;
  U = S + T;
  cout << U << endl;
}
