func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, f = 0, ans, m, a1[20], flag = 0, a2[20], b1[20], b2[20], num[20] = {0},            c = 0;     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> a1[i] >> a2[i];     for (int i = 0; i < m; i++) cin >> b1[i] >> b2[i];     for (int i = 0; i < n; i++) {       int cura = 0, curb = 0;       for (int j = 0; j < m; j++) {         if ((a1[i] == b1[j] && a2[i] != b2[j]) ||             (a1[i] == b2[j] && a2[i] != b1[j]))           num[a1[i]]++, cura++;         if ((a2[i] == b1[j] && a1[i] != b2[j]) ||             (a2[i] == b2[j] && a1[i] != b1[j]))           num[a2[i]]++, curb++;       }       if (cura > 0 && curb > 0) flag = 1;     }     for (int i = 0; i < m; i++) {       int cura = 0, curb = 0;       for (int j = 0; j < n; j++) {         if ((b1[i] == a1[j] && b2[i] != a2[j]) ||             (b1[i] == a2[j] && b2[i] != a1[j]))           cura++;         if ((b2[i] == a1[j] && b1[i] != a2[j]) ||             (b2[i] == a2[j] && b1[i] != a1[j]))           curb++;       }       if (cura > 0 && curb > 0) flag = 1;     }     for (int i = 0; i < 15; i++)       if (num[i] > 0) c++, f = i;     if (flag)       cout << -1 << endl;     else if (c > 1)       cout << 0 << endl;     else       cout << f << endl;     return 0;   }   