#include <bits/stdc++.h>
using namespace std;
const int Maxn = 110;
const int INF = 0x7f7f7f7f;
const double eps = 1e-8;
const double pi = 3.1415926535897932384626433832795;
bool used[Maxn];
int cnt1[300], cnt2[300];
string s1[Maxn], s2[Maxn];
int main() {
  int n;
  bool first = true;
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s1[i];
    cnt1[s1[i][0]]++;
  }
  for (int i = 0; i < n; i++) {
    cin >> s2[i];
    cnt2[s2[i][0]]++;
  }
  sort(s1, s1 + n);
  sort(s2, s2 + n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      if (!used[j])
        if (s1[i][0] == s2[j][0] || ((cnt1[s1[i][0]] > cnt2[s1[i][0]]) &&
                                     (cnt2[s2[j][0]] > cnt1[s2[j][0]]))) {
          used[j] = 1;
          cnt2[s2[j][0]]--;
          if (!first) cout << ", ";
          first = 0;
          cout << s1[i] << " " << s2[j];
          break;
        }
    cnt1[s1[i][0]]--;
  }
  return 0;
}
