#include <bits/stdc++.h>
using namespace std;
struct Name {
  char s[20];
};
Name a[101];
Name b[101];
int m[101][101];
int from[101], flag[101];
bool mark[101];
int t[101];
int n;
bool dfs(int u, int fl) {
  if (flag[u] == fl) return 0;
  flag[u] = fl;
  for (int i = 1; i <= n; i++)
    if (!mark[i] && m[u][i] && (from[i] == 0 || dfs(from[i], fl))) {
      from[i] = u;
      return true;
    }
  return false;
}
bool cmp(Name p, Name q) {
  for (int i = 0; i <= 10; i++)
    if (p.s[i] != q.s[i]) return p.s[i] < q.s[i];
  return true;
}
void solve(int k, int &ans) {
  memset(flag, 0, sizeof(flag));
  memset(from, 0, sizeof(from));
  for (int i = k; i <= n; i++)
    if (!flag[i]) ans += dfs(i, i);
  return;
}
int main() {
  int ans1 = 0;
  int cnt;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%s", a[i].s);
  for (int i = 1; i <= n; i++) scanf("%s", b[i].s);
  sort(a + 1, a + n + 1, cmp);
  sort(b + 1, b + n + 1, cmp);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[i].s[0] == b[j].s[0]) m[i][j] = 1;
  solve(1, ans1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (mark[j]) continue;
      if (a[i].s[0] == b[j].s[0]) {
        ans1--;
        printf("%s %s", a[i].s, b[j].s);
        mark[j] = true;
        break;
      }
      cnt = 0;
      mark[j] = true;
      solve(i + 1, cnt);
      if (cnt == ans1) {
        printf("%s %s", a[i].s, b[j].s);
        break;
      }
      mark[j] = false;
    }
    if (i < n)
      printf(", ");
    else
      printf("\n");
  }
  return 0;
}
