#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

signed main()
{
    long long m, l, w, n, k;
    cin >> m >>l>>w>>n>>k;
    int x;
    for (int i = 1; i <= n; i++)
        cin >> x;
    for (int i = 1; i <= k; i++)
        cin >> x;
    cout << n+k << ' '<< n+k-1;
    return 0;
}
