#include <bits/stdc++.h>
using namespace std;
const int N = 111;
string s1[N], s2[N];
int n, v[N], t1[N], t2[N];
int main() {
  cin >> n;
  for (int i = (1); i <= (n); i++) cin >> s1[i], t1[s1[i][0]]++;
  for (int i = (1); i <= (n); i++) cin >> s2[i], t2[s2[i][0]]++;
  sort(s1 + 1, s1 + 1 + n), sort(s2 + 1, s2 + 1 + n);
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (n); j++)
      if (!v[j] && (s1[i][0] == s2[j][0] || (t1[s1[i][0]] > t2[s1[i][0]] &&
                                             t1[s2[j][0]] < t2[s2[j][0]]))) {
        v[j] = 1, t1[s1[i][0]]--, t2[s2[j][0]]--;
        if (i > 1) cout << ", ";
        cout << s1[i] << " " << s2[j];
        break;
      }
}
