#include using namespace std; #define rep(i, a, b) for (int i= a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (x).size() #define int ll #define F first #define S second #define PB push_back #define MP make_pair typedef long long int; typedef pair pii; typedef vector vi; #define endl '\n' #define inf 3000000000000000000 #define random rand()^(rand()<<15) mt19937 rnd(time(nullptr)); signed main() { cin.tie(0)->sync_with_stdio(0); int n, m, c; cin >> n >> m >> c; int fp = 0, sp = 0; vi sc(m, c); int x, y; rep(i, 0, n) { cin >> x >> y; x--; y--; if (sc[x] > 0) { sc[x]--; fp++; } else if (sc[y] > 0) { sc[y]--; sp++; } } cout << fp << " " << sp << endl; return 0; }