import java.util.*;
class GFG
{
static String getTime(String s, int n)
{
String res = "";
int h = Integer.parseInt(s.substring(0, 0 + 2));
int m = Integer.parseInt(s.substring(3, 3 + 2));
int rev_h = (h % 10) * 10 +
((h % 100) - (h % 10)) / 10;
String rev_hs = Integer.toString(rev_h);
if (h == 23 && m >= 32)
{
res = "-1";
}
else if (m < rev_h)
{
String temp = "";
if (h < 10)
temp = "0";
temp = temp + Integer.toString(h);
if (rev_h < 10)
res = res + temp + ":0" + rev_hs;
else
res = res + temp + ":" + rev_hs;
}
else
{
h++;
rev_h = (h % 10) * 10 + ((h % 100) -
(h % 10)) / 10;
rev_hs = Integer.toString(rev_h);
String temp = "";
if (h < 10)
temp = "0";
temp = temp + Integer.toString(h);
if (rev_h < 10)
res = res + temp + ":0" + rev_hs;
else
res = res + temp + ":" + rev_hs;
}
return res;
}
public static void main(String[] args)
{
String s = "21:12";
int n = s.length();
System.out.println(getTime(s, n));
}
}