#include<bits/stdc++.h>
#define lp3(i,a,b) for(int i=a;i<b;i++)
#define lp2(i,n) for(int i=0;i<n;i++)
#define ll long long
#define W 1000000007
using namespace std;

int main(){
	int n;
	cin>>n;
	int h = n/30,m = 2 * (n%30);
	cout<<h<<" "<<m<<endl;
	return 0;
}

