https://www.acmicpc.net/problem/2884
using System;
class Program
{
static void Main() {
string[] s=Console.ReadLine().Split(' ');
int h=int.Parse(s[0]);
int m=int.Parse(s[1]);
m-=45;
if(m<0){
h--;
m+=60;
}
if(h<0) h=23;
Console.Write("{0} {1}",h,m);
}
}