b = gets

if b == nil then
  exit
else
  b = b.chomp
end

def putOther(arg1, arg2, targetnum)
  if arg1 == targetnum then
    puts arg2
  else
    puts arg1
  end
end

ar1 = ["A", "T"]
ar2 = ["C", "G"]

if ar1.include?(b) then
  putOther(ar1[0], ar1[1], b)
else
  putOther(ar2[0], ar2[1], b)
end
