#include <bits/stdc++.h>
using namespace std;
char **a = new char *[100], **s = new char *[100], **d;
int cmp(char *a, char *s) {
  int w = 0;
  for (; a[w]; w++) {
    if (a[w] < s[w]) return 0;
    if (a[w] > s[w]) return 2;
  }
  if (s[w]) return 0;
  return 1;
}
void qs(int q, int w) {
  int e = q, r = w;
  char *t = d[q + (rand() % (w - q + 1))], *y;
  do {
    while (cmp(d[e], t) == 0) e++;
    while (cmp(d[r], t) == 2) r--;
    if (e <= r) {
      y = d[e];
      d[e] = d[r];
      d[r] = y;
      e++;
      r--;
    }
  } while (e <= r);
  if (q < r) qs(q, r);
  if (e < w) qs(e, w);
}
int main() {
  int q, w, e, r, t, f[100], h[100];
  for (w = 0; w < 100; w++) h[w] = 0;
  scanf("%d", &q);
  for (w = 0; w < q; w++) {
    a[w] = new char[11];
    scanf("%s", a[w]);
    h[a[w][0]]++;
    f[w] = 1;
  }
  for (w = 0; w < q; w++) {
    s[w] = new char[11];
    scanf("%s", s[w]);
    h[s[w][0]]--;
  }
  d = a;
  qs(0, q - 1);
  d = s;
  qs(0, q - 1);
  for (w = 0; w < q; w++) {
    if (w) printf(", ");
    printf("%s ", a[w]);
    e = 0;
    while (1) {
      for (; !f[e]; e++)
        ;
      if (a[w][0] == s[e][0]) {
        printf("%s", s[e]);
        f[e] = 0;
        break;
      }
      if (h[s[e][0]] >= 0) {
        e++;
        continue;
      }
      if (h[a[w][0]] > 0) {
        printf("%s", s[e]);
        f[e] = 0;
        h[a[w][0]]--;
        h[s[e][0]]++;
        break;
      }
      e++;
    }
  }
  return 0;
}
