#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int n,m,k;
vector<pair<int,int>> v;
vector<pair<int,int>> item;
int dish[105];
int ans = 0;

void chk(){
    int result = 0;
    for(int i=0;i<m;i++){
        if(dish[v[i].first]>0&&dish[v[i].second]>0) result++;
    }
    ans = max(ans,result);
}

void dfs(int idx){
    if(idx==k){
        chk();
        return;
    }
    dish[item[idx].first]++;
    dfs(idx+1);
    dish[item[idx].first]--;
    dish[item[idx].second]++;
    dfs(idx+1);
    dish[item[idx].second]--;
}

int main(void){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        v.push_back({a,b});
    }
    cin >> k;
    for(int i=0;i<k;i++){
        int c,d;
        cin >> c >> d;
        item.push_back({c,d});
    }
    dfs(0);
    cout << ans;

    return 0;
}
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define pb push_back
#define INF 1000000000
#define LL_MAX 1000000000000000000
#define LL_MIN -1000000000000000000
#define mod 1000000007
#define mod2 998244353
#define PI 3.14159265358979323846264338327950288419716939937510
#define ll long long
#define ld long double
#define vi vector <int>
#define vb vector<bool>
#define vvi vector <vector<int>>
#define vvb vector <vector<bool>>
#define vvvi vector <vector<vector<int>>>
#define vll vector<ll>
#define vvl vector <vector<ll>>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pair<int,int>>
#define pld pair<ld,ld>
#define vpll vector<pair<ll,ll>>
#define vpld vector<pair<ld,ld>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define FIO   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fs(x) fixed<<setprecision(x)
#define print(a) {for(auto x:a){cout << x << " ";}}
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// template <typename T>
// using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

bool chmin(ll& a, const ll& b) {
	return b < a ? a = b, 1 : 0;
}
bool chmax(ll& a, const ll& b) {
	return a < b ? a = b, 1 : 0;
}
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

const int N = 3e5 + 5;

void run_case() {
	int n;
	ld D, H;
	cin >> n >> D >> H;
	ld ans = 0;
	for (int i = 0; i < n; i++) {
		int d, h;
		cin >> d >> h;
		ld x = (ld)H - ((ld)(H - h) / (D - d)) * D ;
		if (x > ans )ans = x;
	}
	cout << fs(20) << ans << endl;
}
auto clk = clock();
int main()
{

	FIO
#ifndef ONLINE_JUDGE
	//for getting input from input.txt
	freopen("input.txt", "r", stdin);
	//for writting output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int t;
	//cin >> t;
	t = 1;
	for (int i = 1; i <= t; i++) {
		//cout << "case #" << i << ": " ;
		run_case();
	}
#ifndef ONLINE_JUDGE
	cout << endl
	     << "Time elapsed: " << fs(10) << (double)(clock() - clk) / CLOCKS_PER_SEC << endl
	     << endl;
#endif
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * in case of segmentation fault check for ex- a variable declared more than once , or index becoming negative
    * check TLE due to not clearing adjacency list for each test
    * do smth instead of nothing and stay organized
    * BELIEVE in yourself
*/