func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 20;   int a[N], b[N], c[N], d[N], ln[N], rn[N], lm[N], rm[N];   int main() {     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; i++) {       cin >> a[i] >> b[i];       if (a[i] > b[i]) swap(a[i], b[i]);     }     set<int> st;     for (int i = 1; i <= m; i++) {       cin >> c[i] >> d[i];       if (c[i] > d[i]) swap(c[i], d[i]);       for (int j = 1; j <= n; j++) {         if (a[j] == c[i] && b[j] == d[i]) continue;         if (a[j] == c[i]) ln[j] = lm[i] = 1, st.insert(a[j]);         if (a[j] == d[i]) ln[j] = rm[i] = 1, st.insert(a[j]);         if (b[j] == c[i]) rn[j] = lm[i] = 1, st.insert(b[j]);         if (b[j] == d[i]) rn[j] = rm[i] = 1, st.insert(b[j]);       }     }     for (int i = 1; i <= n; i++)       if (ln[i] && rn[i]) {         puts( -1 );         return 0;       }     for (int i = 1; i <= m; i++)       if (lm[i] && rm[i]) {         puts( -1 );         return 0;       }     if (st.size() == 1) {       cout << *st.begin();       return 0;     }     puts( 0 );     return 0;   }   