#include <bits/stdc++.h>
using namespace std;
const int mm = 110;
bool vis[mm];
class node {
 public:
  char s[mm];
} s[mm], ss[mm];
int ans[mm];
bool cmp(node a, node b) { return strcmp(a.s, b.s) < 0; }
int n;
int va[mm], vb[mm];
int main() {
  while (cin >> n) {
    memset(va, 0, sizeof(va));
    memset(vb, 0, sizeof(vb));
    for (int i = 0; i < n; i++) {
      cin >> s[i].s;
      ++va[s[i].s[0]];
    }
    for (int j = 0; j < n; j++) {
      cin >> ss[j].s;
      ++vb[ss[j].s[0]];
    }
    sort(s, s + n, cmp);
    sort(ss, ss + n, cmp);
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < n; i++) {
      int k;
      for (int j = 0; j < n; j++)
        if ((!vis[j] && s[i].s[0] == ss[j].s[0]) ||
            (!vis[j] && va[s[i].s[0]] > vb[s[i].s[0]] &&
             va[ss[j].s[0]] < vb[ss[j].s[0]])) {
          k = j;
          --va[s[i].s[0]];
          --vb[ss[j].s[0]];
          break;
        }
      ans[i] = k;
      vis[k] = 1;
    }
    cout << s[0].s << " " << ss[ans[0]].s;
    for (int i = 1; i < n; i++) {
      cout << ", " << s[i].s << " " << ss[ans[i]].s;
    }
    cout << "\n";
  }
}
