#include using namespace std; int c(int y) { return 365 + (y % 4 != 0 || (y % 100 == 0 && y % 400 != 0) ? 0 : 1); } int main() { int Y, N, D; cin >> Y >> N >> D; if(D > 333) { D -= c(Y - 12) - c(Y + 1); } // wrong cout << N - min(N, D) << " " << min(N, c(Y - 12) - D) << endl; } // WA 16