Problem:
Score : 100 points

Problem Statement

On the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.

You are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the base that bonds with the base b.

Constraints

b is one of the letters A, C, G and T.

Input

Input is given from Standard Input in the following format:

b

Output

Print the letter representing the base that bonds with the base b.

Sample Input 1

A

Sample Output 1

T

Sample Input 2

G

Sample Output 2

C

Solution in Ruby (2.3.3) (judge verdict: Runtime Error)

CS = ["012".to_i(4), "102".to_i(4), "021".to_i(4)]
CS2 = ["132".to_i(4), "112".to_i(4), "212".to_i(4), "312".to_i(4)]

IS = (0..63).to_a

def init3
  IS.map do |i| CS.include?(i) ? 0: 1 end
end

def f(m, xs)
  if (m == 0)
    sum(xs) % 1000000007
  else
    f(m-1, IS.map do |i| g(xs, i) end)
  end
end

def g(xs, i)
  ab = i / 4
  case i
  when *CS then 0
  when *CS2 then h(xs, ab, [16,32,48])
  else h(xs, ab, [0,16,32,48])
  end
end

def h(xs, ab, js)
  sum(js.map do |j| xs[ab + j] end) % 1000000007
end

def sum(xs)
  xs.inject(0) {|c,x| c + x }
end

n = gets.chomp.to_i

p(f(n-3, init3))