#include<iostream>
#include<stdio.h>using namespace std;
class Time{
public:
void settime(int x, int y, int z);
void showtime();
private:
int hour, minute, sencond;
};
void Time::settime(int x, int y, int z)
{
if(x > 12 || x < 0)
hour = 12;
else
hour = x;
if(y > 23 || y < 0)
minute = 0;
else
minute = y;
if(z > 59 || z < 0)
sencond = 0;
else
sencond = z;
}
void Time::showtime()
{
printf("%02d:%02d:%02d",hour,minute,sencond);
}
int main(){
Time T;
int x, y, z;
cin>>x>>y>>z;
T.settime(x,y,z);
T.showtime();
return 0;
}