using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0074
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Min() == -1 && x.Max() == -1) break;
                TimeSpan video = new TimeSpan(2,0,0);
                TimeSpan time = new TimeSpan(x[0],x[1],x[2]);
                Console.WriteLine(video - time);
                int a = x[0] * 3600 + x[1] * 60 + x[2];
                a /= 3;
                time = new TimeSpan(a / 3600,(a % 3600) / 60,a % 60);
                Console.WriteLine(video - time);
            }
        }
    }
}
