#include using namespace std; int main(){ int y,n,d; cin >> y >> n >> d; cout << max(0,n - d) << " "; if(y%4!=0) cout << min(n,365 - d) << endl; else cout << min(n,366 - d) << endl; }