        getline(cin, tmp);
        sscanf(tmp.c_str(), "%d %d", &M, &N);

        for (int i = 1; i <= M; i++) getline(cin, names1[i]);
        for (int i = 1; i <= N; i++) getline(cin, names2[i]);

        S.clear();