Sample input:
5
3 2 3
100 100 100
50 49 49
10 30 20
1 1000000000 1000000000
Sample output:
YES
3 2 1
YES
100 100 100
NO
NO
YES
1 1 1000000000
My code for this problem:
for _ in range(int(input())):
x,y,z = map(int,input().split())
if x == y == z:
print("YES")
print(x,y,z,sep=" ")
elif x == y or x == z or y == z:
if [x,y,z].count(max(x,y,z)) == 2:
a = [x,y,z]
a.sort()
if a[0] > 1:
print(max(x,y,z),a[0],a[0]-1,sep=" ")
else:
print(max(x,y,z),a[0],a[0],sep=" ")
else:
print("NO")
else:
print("NO")
Output is okay for sample input.But am i solving this problem correctly?