/*pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
//constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-7;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

// MOD確認

ll N,M,K;
ll A[110],B[110];
ll C[110],D[110];
ll E[110];

int main(){
   ll ans = 0;
   cin >> N >> M;
   rep(i,M) cin >> A[i] >> B[i];
   cin >> K;
   rep(i,K) cin >> C[i] >> D[i];
   rep(i,(1LL << K)){
      rep(j,105) E[j] = 0;
      rep(j,K){
         if(i & (1LL<<j)) E[C[j]]++;
         else E[D[j]]++;
      }
      ll cnt = 0;
      rep(j,M) if(E[A[j]] >= 1 && E[B[j]] >= 1) cnt++;
      ans = max(ans,cnt);
   }
   cout << ans << endl;
}

/*Name:- Prince Soni
College:- Jalpaiguri Government Engineering College*/

// this is how we declare a constant value
// const int xyz=2500000;


#include <bits/stdc++.h> 
using namespace std; 

#define ll long long int
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define fr(i,n) for(ll i=0;i<n;i++)
#define fr1(i,n) for(ll i=1;i<=n;i++)
#define endl "\n"
#define mp make_pair
#define inf 1000000009

int main() 
{ 
    fio;
    ll n;
    cin>>n;
    ll a[n];
    fr(i,n)
    cin>>a[i];
    ll ans=0,res;
    for(int i=2;i<=1000;i++)
    {
        ll c=0;
        for(int j=0;j<n;j++)
        {
            if(a[j]%i==0)
            c++;
        }
        if(max(ans,c)==c)
        {
            ans=max(ans,c);
            res=i;
        }
    }
    cout<<res<<endl;
}