as = gets.split.map(&:to_i)

(1..4**2).each do |x|
  sum = 0
  (0..3).each do |i|
    if x & (1<< i) == 0
      sum += as[i]
    end
  end
  if sum * 2 == as.inject(:+)
    puts 'YES'
    exit
  end
end
puts 'NO'

a = gets.split.map &:to_i
(0..15).each do |x|
  f, s = 0, 0
  (0..3).each { |i| x & 1 << i != 0 ? f += a[i] : s += a[i] }
  if f == s
    puts 'YES'
    exit
  end
end
puts 'NO'

a = gets.split.map &:to_i
a.permutation.each do |p|
  if p[0] + p[1] == p[2] + p[3]
    puts 'YES'
    exit
  end
end
puts 'NO'

a = gets.split.map(&:to_i).sort
puts a[0] + a[3] == a[1] + a[2] ? 'YES' : 'NO'


#!/usr/bin/env ruby
point,x, y = [], [], []
8.times do
  point << gets.split(' ').map(&:to_i)
  x << point[-1][0] unless x.include? point[-1][0]
  y << point[-1][1] unless y.include? point[-1][1]
end
if x.sort!.size == 3 && y.sort!.size == 3
  if point.uniq.size == point.size && !point.include?([x[1], y[1]])
    puts "respectable"
  else
    puts "ugly"
  end
else
  puts "ugly"
end

points =[]
for i in 1..8
 temp=gets.chomp.split.collect{|a| a.to_i}
 points.push temp
end
xs=points.collect{|a| a.first}.sort.uniq
ys=points.collect{|a| a.last }.sort.uniq
#puts xs,ys
#puts points.uniq.length
if xs.length!=3 ||ys.length!=3 || points.uniq.length !=8
   puts "ugly"
else
  avg=[xs[1],ys[1]]
 # puts avg
  if points.include? avg
     puts "ugly"
  else
      puts"respectable"
  end
end

points = 8.times.map{|i| gets.split.map(&:to_i) }.uniq
puts [:first, :last].all?{|sym| points.group_by(&sym).to_a.sort_by(&:first).map{|x| x.last.length} == [3,2,3] } ? "respectable" : "ugly"

xy = []
8.times do
  x,y = gets.split(' ').map(&:to_i)
  xy << [x,y]
end

xs,ys = xy.transpose
xxs = xs.sort.uniq
yys = ys.sort.uniq

ok = xy.uniq.size == 8
xxs.each.with_index do |x,i|
  if xs.count(x) != (i == 1 ? 2 : 3)
    ok = false
    break;
  end
end if ok

yys.each.with_index do |y,i|
  if ys.count(y) != (i == 1 ? 2 : 3)
    ok = false
    break;
  end
end if ok

if !ok || xxs.size != 3 || yys.size != 3 || xy.include?([xxs[1], yys[1]])
  puts "ugly"
else
  puts "respectable"
end

def runb(list)
  x = list.map{|x,y| x}.uniq.sort
  y = list.map{|x,y| y}.uniq.sort

  return false unless x.size == 3
  return false unless y.size == 3
  x.each_with_index do |x,i|
    y.each_with_index do |y,j|
      if (i == j) and (j == 1)
        return false if list.member?([x,y])
      else
        return false unless list.member?([x,y])
      end
    end
  end
  return true
end

def run(list)
  runb(list) ? "respectable" : "ugly"
end

def convert(n)
  n.split(' ').map(&:to_i)
end

n = gets
list = []
while n != nil
  list << convert(n)
  if list.size == 8
    puts run(list)
    list = []
  end
  n = gets
end

#0 0
#2 1
#1 0
#0 2
#2 2
#1 0
#2 1
#0 2

x=[]
y=[]
8.times do
  a,b=gets.split.map(&:to_i)
  x<<a
  y<<b
end
a=x.uniq.sort
b=y.uniq.sort
if a.size!=3 or b.size!=3
  puts 'ugly'
  exit
end
p=[]
3.times do |i|
  3.times do |j|
    next if i==1 and j==1
    p << [a[i],b[j]]
  end
end
8.times do |i|
  p.delete([x[i],y[i]])
end
if p.size == 0
  puts 'respectable'
else
  puts 'ugly'
end

# http://codeforces.com/problemset/problem/334/B
list = []
list_x = []
list_y = []
8.times do |i|
  list << gets.chomp.split.map(&:to_i)
  list_x << list[i][0]
  list_y << list[i][1]
end

def eight_point_set(list, list_x, list_y)
  for i in 0..7
    for j in (i + 1)..7
      if list[j] == list[i]
        return "ugly"
      end
    end
  end

  sorted_list_x = list_x.sort
  sorted_list_y = list_y.sort
  avg_x, avg_y = 0, 0

  for i in 0..7
    avg_x += 1 if sorted_list_x[i] == sorted_list_x[3]
    avg_y += 1 if sorted_list_y[i] == sorted_list_y[3]
  end

  return avg_x == 2 && avg_y == 2 ? "respectable" : "ugly"
end

puts eight_point_set(list, list_x, list_y)

# http://codeforces.com/problemset/problem/334/B
list = []
list_x = []
list_y = []
8.times do |i|
  list << gets.chomp.split.map(&:to_i)
  list_x << list[i][0]
  list_y << list[i][1]
end

def eight_point_set(list, list_x, list_y)
  hash = Hash.new { |hash, key| hash[key] = 0 }
  for i in 0..7
    hash[list[i]] += 1

    if hash[list[i]] > 1
      return "ugly"
    end
  end

  sorted_list_x = list_x.sort
  sorted_list_y = list_y.sort
  avg_x, avg_y = 0, 0

  for i in 0..7
    avg_x += 1 if sorted_list_x[i] == sorted_list_x[3]
    avg_y += 1 if sorted_list_y[i] == sorted_list_y[3]
  end

  return avg_x == 2 && avg_y == 2 ? "respectable" : "ugly"
end

puts eight_point_set(list, list_x, list_y)

xs, ys = [], []
x_count, y_count = {}, {}
8.times do
	x, y = STDIN.readline.split.map {|s| s.to_i }
	xs.push(x)
	ys.push(y)
	x_count[x] = (x_count[x] || 0) + 1
	y_count[y] = (y_count[y] || 0) + 1
end
[x_count, y_count].each do |z_count|
	values = z_count.values.sort
	if values.length != 3
		puts 'ugly'
		exit
	end
end
input_points = xs.zip(ys).sort
x1, x2, x3 = x_count.keys.sort
y1, y2, y3 = y_count.keys.sort
constructed_points = [[x1, y1], [x1, y2], [x1, y3],
					  [x2, y1], [x2, y3],
					  [x3, y1], [x3, y2], [x3, y3]].sort
if constructed_points == input_points
	puts 'respectable'
else
	puts 'ugly'
end

xs, ys = [], []
x_count, y_count = {}, {}
8.times do
	x, y = STDIN.readline.split.map {|s| s.to_i }
	xs.push(x)
	ys.push(y)
	x_count[x] = (x_count[x] || 0) + 1
	y_count[y] = (y_count[y] || 0) + 1
end
if x_count.values.length != 3 || y_count.values.length != 3
	puts 'ugly'
	exit
end
input_points = xs.zip(ys).sort
x1, x2, x3 = x_count.keys.sort
y1, y2, y3 = y_count.keys.sort
constructed_points = [[x1, y1], [x1, y2], [x1, y3],
					  [x2, y1], [x2, y3],
					  [x3, y1], [x3, y2], [x3, y3]].sort
puts constructed_points == input_points ? 'respectable' : 'ugly'

#!/usr/bin/env ruby
point,x, y = [], [], []
8.times do
  point << gets.split(' ').map(&:to_i)
  x << point[-1][0] unless x.include? point[-1][0]
  y << point[-1][1] unless y.include? point[-1][1]
end
if x.sort!.size == 3 && y.sort!.size == 3
  ok = true
  for i in 0...3
    for j in 0...3
      next if i == 1 && j == 1
      ok = false unless point.include?([x[i], y[j]])
    end
  end
  puts ok ? "respectable" : "ugly"
else
  puts "ugly"
end

#!/usr/bin/env ruby
point,x, y = [], [], []
8.times do
  point << gets.split(' ').map(&:to_i)
  x << point[-1][0] unless x.include? point[-1][0]
  y << point[-1][1] unless y.include? point[-1][1]
end
if x.size == 3 && y.size == 3
  ok = true
  for i in 0...3
    for j in 0...3
      next if i == 1 && j == 1
      ok = false unless point.include?([x[i], y[j]])
    end
  end
  puts ok ? "respectable" : "ugly"
else
  puts "ugly"
end

#!/usr/bin/env ruby
point,x, y = [], [], []
8.times do
  point << gets.split(' ').map(&:to_i)
  x << point[-1][0] unless x.include? point[-1][0]
  y << point[-1][1] unless y.include? point[-1][1]
end
if x.size == 3 && y.size == 3
  if x.size > 1 && y.size > 1 && point.include?([x.sort[1], y.sort[1]])
    puts "ugly"
  else
    puts "respectable"
  end
else
  puts "ugly"
end

#!/usr/bin/env ruby
point,x, y = [], [], []
8.times do
  point << gets.split(' ').map(&:to_i)
  x << point[-1][0] unless x.include? point[-1][0]
  y << point[-1][1] unless y.include? point[-1][1]
end
if x.sort!.size == 3 && y.sort!.size == 3
  if point.uniq.size == point.size && point.include?([x[1], y[1]])
    puts "respectable"
  else
    puts "ugly"
  end
else
  puts "ugly"
end

points =[]
for i in 1..8
 temp=gets.chomp.split.collect{|a| a.to_i}
 points.push temp
end
xs=points.collect{|a| a.first}.uniq
ys=points.collect{|a| a.last }.uniq
#puts xs,ys
if xs.length!=3 ||ys.length!=3
   puts "ugly"
else
  avg=[xs[1],ys[1]]
 # puts avg
  if points.include? avg
     puts "ugly"
  else
      puts"respectable"
  end
end

points =[]
for i in 1..8
 temp=gets.chomp.split.collect{|a| a.to_i}
 points.push temp
end
xs=points.collect{|a| a.first}.uniq.sort
ys=points.collect{|a| a.last }.uniq.sort
#puts xs,ys
if xs.length!=3 ||ys.length!=3 || temp.uniq !=8
   puts "ugly"
else
  avg=[xs[1],ys[1]]
 # puts avg
  if points.include? avg
     puts "ugly"
  else
      puts"respectable"
  end
end

points =[]
for i in 1..8
 temp=gets.chomp.split.collect{|a| a.to_i}
 points.push temp
end
xs=points.collect{|a| a.first}.sort.uniq
ys=points.collect{|a| a.last }.sort.uniq
#puts xs,ys
if xs.length!=3 ||ys.length!=3 || points.uniq !=8
   puts "ugly"
else
  avg=[xs[1],ys[1]]
 # puts avg
  if points.include? avg
     puts "ugly"
  else
      puts"respectable"
  end
end

points =[]
for i in 1..8
 temp=gets.chomp.split.collect{|a| a.to_i}
 points.push temp
end
xs=points.collect{|a| a.first}.uniq.sort
ys=points.collect{|a| a.last }.uniq.sort
#puts xs,ys
if xs.length!=3 ||ys.length!=3
   puts "ugly"
else
  avg=[xs[1],ys[1]]
 # puts avg
  if points.include? avg
     puts "ugly"
  else
      puts"respectable"
  end
end

xy = []
8.times do
  x,y = gets.split(' ').map(&:to_i)
  xy << [x,y]
end

xs,ys = xy.transpose
xxs = xs.sort.uniq
yys = ys.sort.uniq

ok = true
xxs.each do |x|
  if xs.count(x) != 3
    ok = false
    break;
  end
end

yys.each do |y|
  if ys.count(y) != 3
    ok = false
    break;
  end
end if ok

if !ok || xxs.size != 3 || yys.size != 3 || xy.include?([xxs[1], yys[1]])
  puts "ugly"
else
  puts "respectable"
end

xy = []
8.times do
  x,y = gets.split(' ').map(&:to_i)
  xy << [x,y]
end

xs,ys = xy.transpose
xxs = xs.sort.uniq
yys = ys.sort.uniq

ok = true
xxs.each.with_index do |x,i|
  if xs.count(x) != (i == 1 ? 2 : 3)
    ok = false
    break;
  end
end

yys.each.with_index do |y,i|
  if ys.count(y) != (i == 1 ? 2 : 3)
    ok = false
    break;
  end
end if ok

if !ok || xxs.size != 3 || yys.size != 3 || xy.include?([xxs[1], yys[1]])
  puts "ugly"
else
  puts "respectable"
end

xy = []
8.times do
  x,y = gets.split(' ').map(&:to_i)
  xy << [x,y]
end

xs,ys = xy.transpose
xxs = xs.sort.uniq
yys = ys.sort.uniq

if xxs.size != 3 || yys.size != 3 || xy.include?([xxs[1], yys[1]])
  puts "ugly"
else
  puts "respectable"
end

def runb(list)
  x = list.map{|x,y| x}.uniq.sort
  y = list.map{|x,y| y}.uniq.sort

  return false unless x.size == 3
  return false unless y.size == 3
  return false if list.member?([x[1],y[1]])
  return true
end

def run(list)
  runb(list) ? "respectable" : "ugly"
end

def convert(n)
  n.split(' ').map(&:to_i)
end

n = gets
list = []
while n != nil
  list << convert(n)
  if list.size == 8
    puts run(list)
    list = []
  end
  n = gets
end

# http://codeforces.com/problemset/problem/334/B
list = []
list_x = []
list_y = []
8.times do |i|
  list << gets.chomp.split.map(&:to_i)
  list_x << list[i][0]
  list_y << list[i][1]
end

def eight_point_set(list, list_x, list_y)
  hash = Hash.new { |hash, key| hash[key] = 0 }
  for i in 0..7
    hash[list[i]] += 0

    if hash[list[i]] > 1
      return "ugly"
    end
  end

  sorted_list_x = list_x.sort
  sorted_list_y = list_y.sort
  avg_x, avg_y = 0, 0

  for i in 0..7
    avg_x += 1 if sorted_list_x[i] == sorted_list_x[3]
    avg_y += 1 if sorted_list_y[i] == sorted_list_y[3]
  end

  return avg_x == 2 && avg_y == 2 ? "respectable" : "ugly"
end

puts eight_point_set(list, list_x, list_y)

# http://codeforces.com/problemset/problem/334/B

list_x = []
list_y = []
8.times do
  pair = gets.chomp.split
  list_x << pair[0].to_i
  list_y << pair[1].to_i
end

list_x = list_x.sort
list_y = list_y.sort

avg_x, avg_y = 0, 0

for i in 0..7
  avg_x += 1 if list_x[i] == list_x[3]
  avg_y += 1 if list_y[i] == list_y[3]
end

puts avg_x == 2 && avg_y == 2 ? "respectable" : "ugly"


str = gets.chomp
str[0] = str[0].capitalize
puts str

s = gets
puts s[0].upcase + s[1, s.length]

word = STDIN.read
puts word.sub(/\w/) {|c| c.capitalize}

s = gets.chomp
s[0] = s[0].upcase
puts s

a = gets.chomp
puts a[0].upcase + a[1..a.length]

s = gets.chop
puts s[0].upcase + s[1..s.size-1]

s = gets.chomp
print s[0].capitalize + s[1..-1]

str = gets.chomp
str1 = str[0]

print str1.capitalize
puts str[1..str.length]

str = gets.chomp
print str[0].capitalize , str[1..str.length]

s = gets
puts s[0].upcase + s[1...s.size]

# http://codeforces.com/problemset/problem/281/A

word = gets.chomp
puts "#{word[0].upcase}#{word[1..(word.length - 1)]}"

input = gets.chomp
l = input.length
sov = Array.new
sov[0] = input[0].upcase
for i in 1...l
    sov.push(input[i])
end
print sov.join

word = gets.chomp.to_s
letters = word.split("")
print letters[0].capitalize
letters[0] = nil
letters.each do |letter|
	print letter
end

n = gets.split('')

n[0].upcase!

puts n.join('')

str = gets ; str[0] = str[0].to_s.upcase ; puts str

s = gets.strip
s = s[0].capitalize + s[1..s.length]
puts s

word = gets.chomp
word[0] = word[0].upcase
puts word

word = String(gets.chomp)
if word[0] == word[0].upcase
  puts word
else
  puts word[0].upcase + word[1...word.length]
end

s = gets.chomp
puts s[0].upcase + s[1..-1]

s = gets.chomp
s[0] = s[0].upcase
puts s

input_word = gets.chomp
input_word[0]=input_word[0].upcase
print input_word

str = gets
a = str[0].upcase
str[0]=a
puts str

str = gets.chomp
first = str[0,1]
first.upcase!
newstr = first + str[1,(str.length-1)]
puts newstr

x=gets.strip.chars.to_a; x[0]=x[0].upcase; puts x.join

a = gets.chomp.to_s
b = a[1..-1].scan(/[A-Z]/).length
c = a[0]
d = []
if c.capitalize == c && b >= 1
puts a
else
a[0] = a[0].upcase
puts a
end

s = gets.chomp.split("")
if s[0] == s[0].upcase
	puts s.join
else
	s0 = s[0].upcase
	s.delete_at(0)
	puts s0 << s.join
end

input =gets
input[0]=input[0].upcase
print input

cad = gets.chomp

cad[0] = cad[0].upcase

puts cad

a=gets.chomp
a=a[0].upcase+a[1..a.length-1]
puts  "#{a}"

n = gets.chomp
m = []
m = n.split("")
print m[0].capitalize
for i in m.drop(1) do
        print i
end

a = gets.chomp
b = a[0]
b = b.upcase
a[0] = b[0]
puts a

line = gets.chomp

line[0] = line[0].upcase
puts line

String word = gets.chomp
word[0]=word[0].capitalize
puts word

word = gets.chomp
first = word.split(//).first.upcase
word[0] = first
puts word

s = gets[0..-2]
code = s[0].ord
code -= 32 if code > "Z".ord
s[0] = code.chr
print s

#!/usr/bin/env ruby

gets.split.collect{|i| puts "#{i[0].upcase}#{i[1..-1]}"}

input = gets.strip

input[0] = input[0].upcase
puts input

string = gets
string[0] = string[0].capitalize
puts string

s = gets.chomp; s[0] = s[0].upcase; puts s

s = gets.chomp
s[0] = s[0].upcase
puts s

string = gets.chomp.split('')
string[0].upcase!

string.each do |item|
	print item
end

arr = gets.chomp.split("")
first_letter = arr.first.upcase
puts [first_letter, arr[1..-1]].flatten.join

a = gets.chomp
print a[0].upcase
print a[1..-1]

s = gets.chomp
s[0] = s[0].capitalize
puts s

str = gets.to_s.strip

def newlife(word)
	first_char = word[0]
	first_char.upcase!
	word[0] = first_char
	word
end

puts newlife(str)

input = gets.chomp

print input.slice!(0).capitalize, input

s = gets
puts s[0].capitalize + s[1..-1]

s = gets.strip
if s[0].ord >= 'a'.ord && s[0].ord <= 'z'.ord then
  s[0] = (s[0].ord - 32).chr
end
puts s

word = gets.chomp
puts word[0].upcase + word[1..-1]

def xenia()
  word = gets.chomp
  letter = word[0]
  letter.upcase!
  print "#{letter}#{word[1..-1]}"
end

xenia

a = gets.chomp
a[0] = a[0].upcase
puts a

#!/usr/bin/ruby1.9

word = STDIN.readline.strip
puts word[0].upcase+word[1..-1]

A = gets.chomp
A[0] = A[0].upcase
puts A

s = gets.chomp
f = s[0].capitalize
puts f + s[1..-1]

a = gets.chomp
b = a.capitalize
puts b[0] + a[1..-1]

str = gets.chomp
puts str[0].upcase + str[1..10**3]

def run(input = STDIN.read)
  line = input.strip
  line[0] = line[0].capitalize
  puts line
end
run

src = gets
src[0] = src[0].upcase
puts src

str = gets.chomp()
str[0] = str[0].upcase
puts str

t = $stdin.readline
tt = t.scan(/./)
tt[0] = t[0].capitalize
puts tt.join('')

s = gets.to_s
puts s[0].upcase + s[1..-1]

x = gets.chomp;
x[0]= x[0].upcase;
puts x;

def run
  line = $stdin.readline.split(//)
  line[0].upcase!
  puts line.join("")
end

run if $0 == __FILE__

inp = gets.chomp
inp = inp.sub(/^./) { |ch| ch.upcase }
puts inp

str = $stdin.gets

str[0] = str[0].upcase! if str[0].upcase!
puts str

w = gets.chomp

puts w[0].upcase + w[1..-1]

s = gets

s[0] = s[0].capitalize;

puts s

test = gets
test[0] = test[0].capitalize
puts test

a = gets.chomp()
puts a[0].upcase << a[1..-1]

s = gets.chomp
puts s[0].capitalize + s[1..-1]

s = gets.strip
t = ""
s.length.times do |i|
    if i == 0
        t += s[i].upcase
    else
        t += s[i]
    end
end
puts t

x = gets.chomp
puts "#{x[0].capitalize + x[1..-1]}"

#STDOUT.flush
#str = gets.chomp
#str_aux = "AEIOUYaeiouy"
#str.each_char { |out|
#	if !str_aux.include? out.to_s
#		print "."
#		print out.downcase
#	end
#}
#puts "\n"

STDOUT.flush
str = gets.chomp
print str[0].upcase
puts str[1..str.size()]

require 'set'
include Math
$stdin = File.open("./input.txt", "r") if ENV["USER"] == "new"
# ====================================

line = gets.strip
line[0] = line[0].upcase
puts line

s = gets.chomp.split(//)
s[0] = s[0].capitalize
puts s

#!/usr/bin/ruby1.9

word = STDIN.readline.strip.capitalize
puts word

def run(input = STDIN.read)
  line = input.strip
  puts line.capitalize
end
run

inp = gets.chomp
inp.sub(/^./) { |ch| ch.upcase }
puts inp

test = gets.chomp
final = test.capitalize
puts final

a = gets.chomp()
puts a[0].upcase!.to_s << a[1..-1]

a = gets.chomp()
b = a[0].upcase!.to_s
puts b << a[1..-1]

word = gets.chomp
word[0].upcase!
puts word

input_word = gets.chomp
print input_word[0].upcase

a = gets.chomp.to_s
b = a[1..-1].scan(/[A-Z]/).length
c = a[0]
if c.upcase == c && b >= 1
puts a
else
c.upcase!
puts a
end

a = gets.chomp.to_s
b = a[1..-1].scan(/[A-Z]/).length
c = a[0]
if c.upcase == c && b >= 1
puts a
else
puts a.capitalize
end

a = gets.chomp.to_s
b = a[1..-1].scan(/[A-Z]/).length
c = a[0]
if c.capitalize == c && b >= 1
puts a
else
puts a.capitalize
end

a = gets.chomp.to_s
b = a[1..-1].scan(/[A-Z]/).length
c = a[0]
if c.capitalize == c && b >= 1
puts a
else
puts a.capitalize!
end

String word = gets.chomp
word[0].capitalize!
puts word

String word = gets.chomp
word.capitalize!
puts word


#!/usr/bin/ruby
hash = {'9' => '0', '8' => '1','7' => '2','6' => '3','5' => '4'}
input_line = gets
res = ''
input_line.each_char do |ch|
    if hash[ch].nil?
        res+=ch;
    else
        if (ch == '9' && res == '')
            res+=ch
        else
            res+=hash[ch]
        end
    end
end

puts res

# coding: utf-8

# if __FILE__ == $0
# end

digits = gets.chomp.split(//).map { |i|
    i = i.to_i
    inverted = 9 - i
    if inverted < i
        inverted
    else
        i
    end
}

# remind leading zero!
if digits[0] == 0
    digits[0] = 9
end

puts digits.join

number = gets.chomp
digits = number.split("")

if digits[0].to_i >= 5 && digits[0].to_i != 9
	digits[0] = 9 - digits[0].to_i
end
if digits[digits.size - 1].to_i >= 5 && digits.size > 1
	digits[digits.size - 1] = 9 - digits[digits.size - 1].to_i
end
if digits.size == 2
	print digits[0].to_i
	print digits[1].to_i
elsif digits.size == 1
	print digits[0].to_i
else
	for i in (1..digits.size-2)
		if digits[i].to_i >= 5
			digits[i] = 9 - digits[i].to_i
		end
	end
	for i in (0..digits.size-1)
		print digits[i].to_i
	end
end

digits = gets.chomp.chars.map(&:to_i)
print digits.shift if digits[0] == 9
puts digits.map{|d| [d,9-d].min}.join

a=gets.chomp.bytes.map{|e|[57-e,e-48].min}
a[0]=9 if a[0]==0
puts a*''

initial_num = ARGF.read

result = ''

initial_num.chars.each_with_index do |c, index|
	i = c.to_i
	if i >= 5
		if i == 9 and index == 0
			result << c
		else
			result << (9-i).to_s
		end
	else
		result << c
	end
end

puts result

# http://codeforces.com/contest/514/problem/A

digits = gets.chomp.chars.map(&:to_i)
inverted = digits.map.with_index do |n, idx|
  case idx
  when 0
    (9 - n) < n && n != 9 ? 9 - n : n
  else
    (9 - n) < n ? 9 - n : n
  end
end

puts inverted.join.to_i

s = gets.chomp.to_s
k = s[0]
for i in 0..s.length - 1
  if s[i].to_i>=5
      s[i] = (9 - s[i].to_i).to_s
  end
end
if s[0] == "0"
    s[0] = k
end
puts s

#!/usr/bin/ruby
# coding: utf-8

s = gets.chomp.to_s
(s.length).times{|i|
  if s[i].to_i >= 5
    if i == 0 and s[i].to_i == 9
      next
    end
    s[i] = (9 - s[i].to_i).to_s
  end
}
puts s

a = gets.strip.chars.each_with_index.map do |ci,i|
  d = ci.ord - '0'.ord
  if i == 0 && d == 9
    d
  elsif d >= 5
    9-d
  else
    d
  end
end
puts a.join

arr = gets.chomp.split("")
arr.each_with_index do |item, index|
  print item.to_i <= 4 ? item : index.to_i == 0 && item.to_i == 9 ? item : 9 - item.to_i
end

x = gets.chomp.chars.map(&:to_i)

tmp = x[0]
x = x[1..-1]

tmp = 9 - tmp if tmp > 4 and tmp < 9

x = x.map { |i|
  if i > 4
    9 - i
  else
    i
  end }

puts ([tmp] + x).join("")

str=gets.to_s
str.chomp!

for i in 0..str.length-1
  x=str[i].to_i
  y=9-x
  if x>y
    str[i]=y.to_s
  else
    str[i]=x.to_s
  end
end

if str[0]=="0"
  str[0]="9"
end

puts str

a = gets.split('').map(&:to_i)
(a.length-1).times{|i|
  if ((i!=0 || a[i]!=9) && a[i]>4)
    print 9-a[i]
  else
    print a[i]
    end
}

res = gets.chomp.chars.map(&:to_i).
         map{|x| [x, 9 -x].min}.map(&:to_s).join('')

res[0] = '9' if res[0] == '0'
puts res

s=gets.chomp
x=s.chars
t=x.shift

p1="8765".index(t)
if p1!=nil then
	t=[1,2,3,4][p1]
else
	t=t.to_i
end
ans=t
x.map{|e|
	ans*=10
	p2="98765".index(e)
	if p2==nil then
		ans=ans+e.to_i
	else
		ans=ans+[0,1,2,3,4][p2]
	end
}
puts ans

s = gets.chomp
if s[0] == '9'
	print '9'
else
	print [s[0].to_i,9-s[0].to_i].min
end
1.upto(s.length - 1) do |i|
	print [s[i].to_i , 9-s[i].to_i].min
end

a = gets.split('').map(&:to_i)
(a.length-1).times{|i|
  if (i!=0 && a[i]>4)
    print 9-a[i]
  else
    print a[i]
    end
}

def read_ints; STDIN.gets.split.map(&:to_i); end

puts gets.chomp.chars.map(&:to_i).
         map{|x| [x, 9 -x].min}.map(&:to_s).join('')

s=gets.chomp
x=s.chars
t=x.shift

p1="8765".index(t)
if p1!=nil then
	t=[1,2,3,4][p1]
	p t
else
	t=t.to_i
end
ans=t
x.map{|e|
	ans*=10
	p2="98765".index(e)
	if p2==nil then
		ans=ans+e.to_i
	else
		ans=ans+[0,1,2,3,4][p2]
	end
}
puts ans

s = gets.chomp
if s[0] == '9'
	print '9'
else
	print [s[0].to_i,9-s[0].to_i].min
end
1.upto(s.length - 1) do |i|
	print [s[0].to_i , 9-s[0].to_i].min
end

# coding: utf-8

# if __FILE__ == $0
# end

digits = gets.chomp.split(//).map { |i|
    i = i.to_i
    inverted = 9 - i
    if inverted < i
        inverted
    else
        i
    end
}

puts digits.join

number = gets.chomp
digits = number.split("")

if digits[0].to_i >= 5 && digits[0].to_i != 9
	digits[0] = 9 - digits[0].to_i
end
if digits[digits.size - 1].to_i >= 5
	digits[digits.size - 1] = 9 - digits[digits.size - 1].to_i
end
if digits.size == 2
	print digits[0].to_i
	print digits[1].to_i
elsif digits.size == 1
	print digits[0].to_i
else
	for i in (1..digits.size-2)
		if digits[i].to_i >= 5
			digits[i] = 9 - digits[i].to_i
		end
	end
	for i in (0..digits.size-1)
		print digits[i].to_i
	end
end

number = gets.chomp
digits = number.split("")

if digits[0].to_i >= 5 && digits[0].to_i != 9
	digits[0] = 9 - digits[0].to_i
end
if digits[digits.size - 1].to_i >= 5 && digits[digits.size - 1].to_i != 9
	digits[digits.size - 1] = 9 - digits[digits.size - 1].to_i
end
if digits.size == 2
	print digits[0].to_i
	print digits[1].to_i
elsif digits.size == 1
	print digits[0].to_i
else
	for i in (1..digits.size-2)
		if digits[i].to_i >= 5 && digits[i].to_i != 9
			digits[i] = 9 - digits[i].to_i
		end
	end
	for i in (0..digits.size-1)
		print digits[i].to_i
	end
end

number = gets.chomp
digits = number.split("")

if digits[0].to_i >= 5
	digits[0] = 9 - digits[0].to_i
end
if digits[digits.size - 1].to_i >= 5
	digits[digits.size - 1] = 9 - digits[digits.size - 1].to_i
end
if digits.size == 2
	print digits[0].to_i
	print digits[1].to_i
elsif digits.size == 1
	print digits[0].to_i
else
	for i in (1..digits.size-2)
		if digits[i].to_i >= 5
			digits[i] = 9 - digits[i].to_i
		end
	end
	for i in (0..digits.size-1)
		print digits[i].to_i
	end
end

number = gets.chomp
digits = number.split("")

if digits[0].to_i >= 5 && digits[0].to_i != 9
	puts "asdf"
	digits[0] = 9 - digits[0].to_i
end
if digits[digits.size - 1].to_i >= 5 && digits.size > 1
	digits[digits.size - 1] = 9 - digits[digits.size - 1].to_i
end
if digits.size == 2
	print digits[0].to_i
	print digits[1].to_i
elsif digits.size == 1
	print digits[0].to_i
else
	for i in (1..digits.size-2)
		if digits[i].to_i >= 5
			digits[i] = 9 - digits[i].to_i
		end
	end
	for i in (0..digits.size-1)
		print digits[i].to_i
	end
end

ans = gets.chomp.chars.map(&:to_i).map{|d| [d,9-d].min}.join.to_i
puts ans==0 ? 9 : ans

initial_num = ARGF.read

result = ''

initial_num.chars.each_with_index do |c, index|
    i = c.to_i
    if i >= 5
        result << (9-i).to_s unless i == 9 and index == 0
    else
        result << c
    end
end

puts result

c = gets.strip
if c == '9'
  puts 0
else
  a = c.chars.each_with_index.map do |ci,i|
    d = ci.ord - '0'.ord
    if i == 0 && d == 9
      d
    elsif d >= 5
      9-d
    else
      d
    end
  end
  puts a.join
end

x = gets.chomp.chars.map(&:to_i)

tmp = x[0]
x = x[1..-1]

tmp = 9 - tmp if tmp > 4 and tmp < 9

x = x.map { |i| 9 - i if i > 4 }

puts ([tmp] + x).join("")

a=gets.chomp.bytes.map{|e|57-e}
a[0]=9 if a[0]==0
puts a*''

# http://codeforces.com/contest/514/problem/A

digits = gets.chomp.chars.map(&:to_i)
digits.map! { |n| (9 - n) < n ? 9 - n : n }

puts digits.join.to_i

arr = gets.chomp.split("")
arr.each do |x| print x.to_i <= 4 ? x : arr[0] == '9' ? arr[0] :
  9 - x.to_i
end

n = gets.to_i
ans = ""
while n > 0 do
  dig = n % 10
  if 9 - dig < dig && 9 - dig != 0
    ans << (9 - dig).to_s
  else
    ans << dig.to_s
  end
  n /= 10
end
puts ans

n = gets.to_i
ans = ""
while n > 0 do
  dig = n % 10
  if 9 - dig < dig
    ans << (9 - dig).to_s
  else
    ans << dig.to_s
  end
  n /= 10
end
puts ans

arr = gets.chomp.split("")
arr.each do |x| print x.to_i <= 4 ? x : arr.size == 1 && arr[0] == '9' ? arr[0] :
  9 - x.to_i
end


a = Array.new(123, gets.split[1].to_i)
gets.chars{|c| a[c.ord] -= 1}
puts a.min < 0 ? :NO : :YES

n,k=gets.split.map &:to_i
h=Hash.new 0
gets.chomp.chars{|c|h[c]+=1}
puts h.values.any?{|e|e>k} ? :NO : :YES

n, k = gets.strip.split.map(&:to_i)
s = gets.strip
ans = "YES"
count = Array.new(26, 0)
n.times do |i|
    count[s[i].ord - 'a'.ord] += 1
end
max_count = count.max
ans = "NO" if max_count > k
puts ans

n,f=gets.split.map{|e| e.to_i}

hs=Hash.new(0)
gets.chomp.chars.each{|e|
	hs[e]+=1
}

v=hs.values.sort.pop

if v<=f then
	puts "YES"
else
	puts "NO"
end

n,k=gets.split.map(&:to_i)
s = gets.chomp
h = Hash.new(0)
s.chars do |c|
    h[c] += 1
end

f = true
[*?a..?z].each do |c|
    if h[c] == 0
        next
    elsif (h[c] - 1) / k > 0
        f = false
        break
    end
end
puts f ? "YES" : "NO"

n, k=gets.split.map(&:to_i)
s=gets.chomp.chars

h=Hash.new(0)
s.each{|c| h[c]+=1}
ok=true
h.each_value do |v|
  ok&=v<=k
end

puts ok ? 'YES' : 'NO'

n,f=gets.split.map{|e| e.to_i}

hs=Hash.new(0)
gets.chomp.chars.each{|e|
	hs[e]+=1
}

vs=hs.values
sum=0
while vs.size >1
	d=vs.shift
	vs=vs.map{|e|
		if d>=e then
			d-=e
			f-=e
			0
		else
			f-=d
			t=e-d
			d=0
			t
		end
	}.select{|e| e>0}
	vs.push(d) if d>0
end
if f<=0 then
	puts "YES"
else
	puts "NO"
end

n,f=gets.split.map{|e| e.to_i}

hs=Hash.new(0)
gets.chomp.chars.each{|e|
	hs[e]+=1
}

vs=hs.values
sum=0
while vs.size >1
	d=vs.shift
	vs=vs.map{|e|
		if d>=e then
			d-=e
			f-=e
			0
		else
			f-=d
			t=e-d
			d=0
			t
		end
	}.select{|e| e>0}
	vs.push(d) if d>0
end
if vs.empty? && f>=0 then
	puts "YES"
else
	puts "NO"
end

n,f=gets.split.map{|e| e.to_i}
hs=Hash.new(0)
gets.chomp.chars.each{|e|
	hs[e]+=1
}
hs.each{|k,v|
	f-=(v/2).to_i
}
if f<=0 then
	puts "YES"
else
	puts "NO"
end

n,k=gets.split.map(&:to_i)
s = gets.chomp
h = Hash.new(0)
s.chars do |c|
    h[c] += 1
end

f = true
[*?a..?z].each do |c|
    if h[c] % 2 == 1
        f = false
        break
    end
end
puts f ? "YES" : "NO"

a = Array.new(123, gets.split[1].to_i)
gets.chars{|c| a[c.ord] -= 1}
p a.min < 0 ? 'NO' : 'YES'


# Input
n = gets.to_i # 2 <= n <= 100
a = gets.split(" ").map! { |b| b.to_i } # 1 <= b <= 100

# Processing
a.sort!
pairs = Array.new(n / 2) { |i| [a[2 * i], a[2 * i + 1]] }
sum = pairs.inject(0) { |mem, p| mem + (p[1] - p[0]) }

# Output
puts sum

class Main
  #def get_problem_link
  #  problem_link = "https://codeforces.com/problemset/problem/1092/B"
  #  return problem_link
  #end

  #def get_submission_link
  #  submission_link = ''
  #  return submisson_link
  #end

  #begin
  #of codeforces interface
  def run_interface
    n = gets.to_i
    k = gets.split(' ').map(&:to_i)
    puts solution(n, k)
  end
  #end
  #of codeforces interface

  def solution(n, students_array)
      res = 0
      students_array.sort!
      (0...students_array.length).step(2).each do |i|
          res = res + (students_array[i+1]-students_array[i]);
      end
      return res
  end

end

#then upload to codeforces uncomment this line:
Main.new.run_interface

n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
ans = 0
(n/2).times do |i|
  ans += a[2*i+1] - a[2*i]
end
p ans

def solution
  count = read_int
  ss = read_ints.sort
  p ss.each_slice(2).map{ |a, b| b - a }.reduce(0, :+)
end

def read_int
  gets.to_i
end

def read_ints
  gets.split.map(&:to_i)
end

def read_string
  gets.chomp
end

solution unless ENV['TEST__MODE']

n = gets.to_i
as = gets.split.map(&:to_i).sort
ans = 0
(0..(n/2-1)).each do |i|
  ans += (as[2*i] - as[2*i+1]).abs
end
puts ans

n = gets.to_i
arr = gets.split.map(&:to_i).sort
res = 0
arr.each_slice(2) do |slice|
  res += slice[1] - slice[0]
end
puts res

n = gets.to_i
a = gets.split.map(&:to_i).sort
ans = 0
(n/2).times do |i|
    ans += a[i*2+1]-a[i*2]
end
puts ans

# coding: utf-8

# if __FILE == $0
# end

n = gets.to_i
skills = gets.split.map { |i| i.to_i }
deltas = 0
skills.sort.each_slice(2) { |a| deltas += a[1] - a[0] }
puts deltas

# https://codeforces.com/problemset/problem/1092/B

def solution(n, a)
  skills = {}
  (0..(n - 1)).each do |i|
    skills[a[i]] = skills.fetch(a[i], 0) + 1
  end

  h = nil

  problems = 0
  100.times do |x|
    i = 100 - x

    next       if !skills.key?(i)
    next       if skills[i] % 2 == 0
    next h = i if h.nil?

    problems += h - i

    h = nil
  end
  return problems
end

n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)

puts solution(n, a)

n = gets.to_i
a = gets.split.map(&:to_i).sort
i, s = 0, 0
while i < a.size
    s += a[i + 1] - a[i]
    i += 2
end
puts s


#!/usr/bin/ruby
n=gets.chomp
p [n,*(1...n.size).map{|i|
	(n[0,i].to_i-1).to_s+'9'*(n.size-i)
}].max_by{|e|[e.chars.map(&:to_i).reduce(:+),e.to_i]}.to_i

def sum(x)
    x.split('').map(&:to_i).inject(0) { |sum, x| sum + x }
end

x = gets.to_i

sx = x.to_s

ans = x
sans = sx

sx.length.times do |i|
    sy = sx[0...i] + (sx[i].to_i - 1).to_s + '9' * (sx.length - i - 1)

    y = sy.to_i
    sy = y.to_s

    if (sum(sy) > sum(sans) || (sum(sy) == sum(sans) && y > ans))
        ans = y
        sans = sy
    end
end

puts sans

#!/usr/bin/ruby
n=gets.chomp
puts [n,*(1...n.size).map{|i|
	(n[0,i].to_i-1).to_s+'9'*(n.size-i)
}].max_by{|e|[e.chars.map(&:to_i).reduce(:+),e.to_i]}

#!/usr/bin/ruby
n=gets.to_i
r=0
d=1
while r<=n
	r=r*10+9
	d*=10
end
d/=10
r-=d while r>n
p [n,r].max_by{|e|[e.to_s.chars.map(&:to_i).reduce(:+),e]}

#!/usr/bin/ruby
n=gets.chomp
puts [n,*(1...n.size).map{|i|
	(n[0,i].to_i-1).to_s+'9'*(n.size-i)
}].max_by{|e|[e.chars.map(&:to_i).reduce(:+),e.to_i,e]}


name = gets.strip
registered_char = []
counter = 0

name.each_char do |char|
  next if registered_char.include?(char)

  registered_char.push(char)
  counter += 1
end

if counter.odd?
  puts 'IGNORE HIM!'
else
  puts 'CHAT WITH HER!'
end

$><<["IGNORE HIM!","CHAT WITH HER!"][gets.chars.uniq.size%2]

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts gets.chomp.chars.uniq.length%2==0?'CHAT WITH HER!':'IGNORE HIM!'

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts gets.chomp.chars.uniq.size%2==0?'CHAT WITH HER!':'IGNORE HIM!'

puts gets.split('').sort.uniq.size % 2==1 ? "CHAT WITH HER!" : "IGNORE HIM!"

puts gets.split(//).uniq.size.odd? ? 'CHAT WITH HER!' : 'IGNORE HIM!'

puts ['IGNORE HIM!','CHAT WITH HER!'][gets.chars.to_a.uniq.size%2]

puts (gets.strip.split('').uniq.size.odd?)?'IGNORE HIM!':'CHAT WITH HER!'

puts ['IGNORE HIM!','CHAT WITH HER!'][gets.split('').uniq.size%2]

if gets.chomp.split("").uniq.size.odd?
 puts "IGNORE HIM!"
else
 puts "CHAT WITH HER!"
end

# http://codeforces.com/problemset/problem/236/A

username = gets.chomp

if username.chars.to_a.uniq.length % 2 == 0
  puts "CHAT WITH HER!"
else
  puts "IGNORE HIM!"
end

puts ["CHAT WITH HER!", "IGNORE HIM!"][gets.chomp.chars.to_a.uniq{|x| x}.length.odd? ? 1 : 0]

puts gets.chomp.split(//).uniq.count.even? ? 'CHAT WITH HER!' : 'IGNORE HIM!'

string = gets.chomp.split("")

arr = []
for i in (0..string.size-1)
	if arr.include?(string[i]) == false
		arr << string[i]
	end
end

if arr.count % 2 == 0
	print "CHAT WITH HER!"
else
	print "IGNORE HIM!"
end

if gets.chomp.split(//).uniq.count.odd?
  puts "IGNORE HIM!"
else
  puts "CHAT WITH HER!"
end

name = gets.strip()
if name.size() <= 100
    array_of_characters = name.chars.uniq
	if array_of_characters.size % 2 == 0
		puts "CHAT WITH HER!"
	else
		puts "IGNORE HIM!"
	end
end

puts gets.chomp.chars.uniq.size%2!=0 ? "IGNORE HIM!" : "CHAT WITH HER!"

puts gets.chomp.chars.uniq.size.even? ? 'CHAT WITH HER!': 'IGNORE HIM!'

x = gets
h = {}
x.split("").each { |e|
    h[e]=1
}
if !h.keys.count.odd?
    puts "IGNORE HIM!"
  else
    puts "CHAT WITH HER!"
end

puts gets.chomp.split("").uniq.count.even? ?  'CHAT WITH HER!' : 'IGNORE HIM!'

def BoyOrGirl(str)
  puts str.chars.uniq.length % 2 == 0 ? "CHAT WITH HER!" : "IGNORE HIM!"
end

str = gets.chomp
BoyOrGirl(str)

puts (gets.split(//).uniq.count.even?) ? "IGNORE HIM!" : "CHAT WITH HER!"

puts ["IGNORE HIM!","CHAT WITH HER!"][gets.chars.uniq.size[0]]

input = gets
puts input.split(//).uniq.count % 2 == 0 ? 'IGNORE HIM!' : 'CHAT WITH HER!'

#!/usr/bin/ruby
puts ['IGNORE HIM!','CHAT WITH HER!'][gets.chars.uniq.size%2]

$><<["IGNORE HIM!","CHAT WITH HER!"][gets.chars.uniq.size%2]

inp = gets.chomp
if inp.split('').uniq.length.odd?
  puts 'IGNORE HIM!'
else
  puts 'CHAT WITH HER!'
end

puts gets.chomp.split("").uniq.length.even? ? "CHAT WITH HER!" : "IGNORE HIM!"

user_name = gets.chomp
i = 0
char_arr = []

while i < user_name.length do
    if char_arr.index(user_name.split('')[i]) == nil then
	char_arr.push(user_name.split('')[i])
    end
    i+=1
end
if char_arr.length % 2 == 0 then
    print 'CHAT WITH HER!'
elsif
    print 'IGNORE HIM!'
end

#!/usr/bin/ruby

str = gets.chomp
cnt = str.each_char.to_a.uniq.size
if cnt.even?
    puts "CHAT WITH HER!"
else
    puts "IGNORE HIM!"
end

puts ['CHAT WITH HER!','IGNORE HIM!'][gets.strip.split('').uniq.join('').length%2]

#$stdin=File.open('input.txt')
#$stdout=File.open('output.txt', 'w')
s=gets.to_s
a=Array.new
for i in 1..s.size-1
	a<<s[i-1]
end
if a.uniq.size%2==0 then
	puts "CHAT WITH HER!"
	else
	puts "IGNORE HIM!"
end

puts gets.chomp.chars.uniq.size % 2 == 0 ? "CHAT WITH HER!" : "IGNORE HIM!"

printf(gets.chomp.each_char.to_a.uniq.size.odd? ? 'IGNORE HIM!' : 'CHAT WITH HER!')

puts gets.split('').uniq.size.odd? ? 'CHAT WITH HER!' : 'IGNORE HIM!'

if gets.chars.to_a.uniq.size % 2 == 0 then puts 'IGNORE HIM!'
else puts 'CHAT WITH HER!'
end

puts gets.split(//).uniq.size.odd? ? 'CHAT WITH HER!' : 'IGNORE HIM!'

username = gets.strip
L = username.length
check = Array.new(26, false)
for i in 0...L
  check[username[i].ord-97] = true
end
count = 0
for i in 0...26
  count += 1 if check[i]
end
if count%2 == 1
  print "IGNORE HIM!"
else
  print "CHAT WITH HER!"
end

printf (gets.chomp.each_char.to_a.uniq.size % 2 == 0) ? 'CHAT WITH HER!' : 'IGNORE HIM!'

w = gets.chomp
if w.scan(/./).uniq.size % 2 == 0
  puts "CHAT WITH HER!"
else
  puts "IGNORE HIM!"
end

def tram ()
  n = gets.chomp
  n = n.split("")
  n = n.uniq
  if n.length % 2 == 0
    print "CHAT WITH HER!"
  else
    print "IGNORE HIM!"
  end
end

tram

name = gets.chomp
amount = Array.new(26, 0)
name.split("").each { |char| amount[char.ord - 97] += 1 }
cnt = 0
amount.each { |tmp| cnt += 1 if tmp > 0 }
if cnt.even?
	puts "CHAT WITH HER!"
else
	puts "IGNORE HIM!"
end

$><<["IGNORE HIM!","CHAT WITH HER!"][gets.chars.uniq.size%2]

if (gets.chomp.split(//).uniq.size % 2) == 1
print "IGNORE HIM!\n"
else
print "CHAT WITH HER!\n"
end

s = gets.split(//).uniq
puts (s.length % 2 == 1) ? "CHAT WITH HER!"  : "IGNORE HIM!"

if gets.strip.split('').to_a.uniq.size % 2 == 0
  puts "CHAT WITH HER!"
else
  puts "IGNORE HIM!"
end

if gets.chomp.split('').uniq.size%2 == 0
  puts "CHAT WITH HER!"
else
  puts "IGNORE HIM!"
end

puts (gets[0..-2].chars.to_a.uniq.count % 2 == 0 ? "CHAT WITH HER!" : "IGNORE HIM!")

name = gets.chomp

puts name.chars.sort.uniq.size.even? ? 'CHAT WITH HER!' : 'IGNORE HIM!'

# Codeforces Round #146
# Problem A -- Boy or Girl
puts gets.split(//).uniq.size.odd? ? "CHAT WITH HER!" : "IGNORE HIM!"

str = gets.chomp
if str.chars.uniq.size.even?
    puts "CHAT WITH HER!"
else
    puts "IGNORE HIM!"
end

u = $stdin.readline.scan(/./).uniq

if u.count % 2 == 1
    puts "IGNORE HIM!"
else
    puts "CHAT WITH HER!"
end

if gets.chomp.split(//).uniq.size % 2 == 0 then puts "CHAT WITH HER!" else puts "IGNORE HIM!" end

hashed = Hash.new(0)
inp = gets.chomp.split("").each { |item| hashed[item] += 1 }
if hashed.size % 2 == 0
 puts "CHAT WITH HER!"
else
  puts "IGNORE HIM!"
end

require 'set'
name = gets.split(//)
s = Set.new
name.each do |char|
  s.add(char)
end
if s.size.even?
  puts "IGNORE HIM!"
else
  puts "CHAT WITH HER!"
end

puts gets.chomp.split("").uniq.join.length.%(2).to_s.include?("1")?"IGNORE HIM!":"CHAT WITH HER!"

puts (gets.chomp.split('').uniq.length.odd?) ? "IGNORE HIM!" : "CHAT WITH HER!"

puts STDIN.read.strip.split(//).uniq.length % 2 == 0 ?  "CHAT WITH HER!" : "IGNORE HIM!"

s = gets.chomp.chars
puts s.uniq.count.odd? ? "IGNORE HIM!" : "CHAT WITH HER!"

s = gets.strip.split("").uniq
ans = s.length.odd?
puts ans ? "IGNORE HIM!" : "CHAT WITH HER!"

$><<["IGNORE HIM!","CHAT WITH HER!"][gets.chars.uniq.size%2]

  x = gets.chomp
  hash = Hash.new
  x.each_char do |c|
    hash[c] = 0 if hash[c] == nil
    hash[c] += 1
  end
  puts "CHAT WITH HER!" if hash.count % 2 == 0
  puts "IGNORE HIM!" if hash.count % 2 != 0

username = gets.chomp
puts (username.split(//).uniq.length % 2 == 1)? "IGNORE HIM!" : "CHAT WITH HER!"

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts(gets.chars.uniq.size%2==0?'CHAT WITH HER':'IGNORE HIM')

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts gets.chars.uniq.size%2?'IGNORE HIM':'CHAT WITH HER'

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts(gets.chars.uniq.length%2==0?"CHAT WITH HER":"IGNORE HIM")

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts gets.chars.uniq.size%2==0?'CHAT WITH HER':'IGNORE HIM'

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts(gets.chomp.chars.uniq.length%2==0?'CHAT WITH HER':'IGNORE HIM')

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts gets.chomp.split(//).uniq.length%2==0?'CHAT WITH HER':'IGNORE HIM'

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts gets.split(//).uniq.length%2==0?'CHAT WITH HER':'IGNORE HIM'

#rextester.com:2.3.1--codeforces.com:2.0.0p645
puts(gets.chars.uniq.length%2==0?'CHAT WITH HER':'IGNORE HIM')

require "set"

set = Set.new(gets.chars)
set.each {|x| puts x}
if set.size() % 2 == 0
  puts "CHAT WITH HER!"
else
  puts "IGNORE HIM!"
end

require "set"

set = Set.new(gets.chop.chars)
set.each {|x| puts x}
if set.size() % 2 == 0
  puts "CHAT WITH HER!"
else
  puts "IGNORE HIM!"
end

require "set"

s = gets
set = Set.new
s.each_char {|c| set << c}
if s.size() % 2 == 0
  puts "CHAT WITH HER!"
else
  puts "IGNORE HIM!"
end

uname = gets.chomp
username = uname.split("")

count = uname.length.to_i
username.each do |n|
	count = count - username.count(n) + 1
	if username.count(n) != 1
		i = username.index(n)
		while i < uname.length.to_i
			if n == username[i+1]
				username.delete_at(i+1)
			end
			i += 1
		end
	end
end

if username.size%2 == 0
	puts "CHAT WITH HER!"
else
	puts "IGNORE HIM!"
end

uname = gets.chomp
username = uname.split("")

count = uname.length.to_i
username.each do |n|
	count = count - username.count(n) + 1
	if username.count(n) > 1
		i = username.index(n)
		while i < uname.length.to_i - 1
			if n == username[i+1]
				username.delete_at(i+1)
			end
			i += 1
		end
	end
end
puts username.size
if username.size%2 == 0
	puts "CHAT WITH HER!"
else
	puts "IGNORE HIM!"
end

uname = gets.chomp
username = uname.split("")

i = 0
count = uname.length.to_i
username.each do |n|
	count = count - username.count(n) + 1
	if username.count(n) != 1
		i = username.index(n)
		while i < uname.length.to_i
			if n == username[i]
				username.delete_at(i)
			end
			i += 1
		end
	end
end

if count%2 == 0
	puts "CHAT WITH HER!"
else
	puts "IGNORE HIM!"
end

uname = gets.chomp
username = uname.split("")

count = uname.length.to_i
username.each do |n|
	count = count - username.count(n) + 1
	if username.count(n) > 1
		i = username.index(n)
		while i < uname.length.to_i - 1
			if n == username[i+1]
				username.delete_at(i+1)
			end
			i += 1
		end
	end
end
if username.size%2 == 0
	puts "CHAT WITH HER!"
else
	puts "IGNORE HIM!"
end

uname = gets.chomp
username = uname.split("")

i = 0
count = uname.length.to_i
username.each do |n|
	count = count - username.count(n) + 1
	if username.count(n) != 1
		i = username.index(n)
		while i+1 < uname.length.to_i
			if n == username[i+1]
				username.delete_at(i+1)
			end
			i += 1
		end
	end
end

if count%2 == 0
	puts "CHAT WITH HER!"
else
	puts "IGNORE HIM!"
end

x = gets
h = {}
x.split("").each { |e|
    h[e]=1
}
if h.keys.count.odd?
    puts "IGNORE HIM!"
  else
    puts "CHAT WITH HER!"
end

# http://codeforces.com/problemset/problem/236/A

chars = gets.chomp
already = {}
dups = 0
chars.each_char do |c|
  if already[c] == true
    dups = dups + 1
  else
    already[c] = true
  end
end

uniq = chars.length - dups

if uniq % 2 == 0
  p 'CHAT WITH HER!'
else
  p 'IGNORE HIM!'
end

inp = gets.chomp
if inp.length.odd?
  puts 'CHAT WITH HER!'
else
  puts 'IGNORE HIM!'
end

inp = gets.chomp
if inp.length.odd?
  p 'CHAT WITH HER!'
else
  p 'IGNORE HIM!'
end

inp = gets.chomp
if inp.split('').uniq.length.odd?
  puts 'CHAT WITH HER!'
else
  puts 'IGNORE HIM!'
end

inp = gets.chomp
if inp.length.odd?
  p 'IGNORE HIM!'
else
  p 'CHAT WITH HER!'
end

puts ['IGNORE HIM!','CHAT WITH HER!'][gets.strip.length%2]

h = {}
gets.split('').each { |c| h[c] = 1 }
puts h.keys.count.even? ? 'CHAT WITH HER!' : 'IGNORE HIM!'

puts gets.split('').uniq.size.even? ? 'CHAT WITH HER!' : 'IGNORE HIM!'

a=gets.chomp
0.upto(a.length-1) do |i|
(i+1).upto(a.length-1) do|j|
if a[i] ==a [j]
a=a[0..j-1]+a[j+1..a.length-1]
end
end
end
if a.length%2==0
puts "CHAT WITH HER!"
else
puts "IGNORE HIM!"
end

p(gets.chomp.each_char.to_a.uniq.size % 2 == 0 ? 'CHAT WITH HER!' : 'IGNORE HIM!')

output = (gets.chomp.each_char.to_a.uniq.size % 2 == 0) ? 'CHAT WITH HER!' : 'IGNORE HIM!'
p output

p(gets.chomp.each_char.to_a.uniq.size % 2 == 0 ? "CHAT WITH HER!" : "IGNORE HIM!")

n = gets.to_s
ar = []
ar = n.split("").map(&:to_s)
j = ar.uniq.count

if j%2 == 0
        puts "CHAT WITH HER!"
else
        puts "IGNORE HIM!"
end
puts j

n = gets.to_s
ar = []
ar = n.split("").map(&:to_s)
j = ar.uniq.count-1

if j%2 == 0
        puts "CHAT WITH HER!"
else
        puts "IGNORE HIM!"
end
puts j

n = gets.to_s
ar = []
ar = n.split("").map(&:to_s)
j = ar.uniq.count - 1

if j%2 == 0
        puts "CHAT WITH HER!"
else
        puts "IGNORE HIM!"
end
puts j

s = gets.split(//).uniq!
puts (s.length % 2 == 1) ? "CHAT WITH HER!"  : "CHAT WITH HIM!"

# while (s=gets.chomp()) != "42" do puts s end

s=gets.chomp()
c= s.split(//).uniq
# s.to_a
# c=b.uniq

# a=s.uniq
if c.length%2==0
    puts "IGNORE HIM!"
else
    puts "CHAT WITH HER!"
end

# while (s=gets.chomp()) != "42" do puts s end

s=gets.chomp()
c= s.split(//).uniq
# s.to_a
# c=b.uniq

# a=s.uniq
puts c.length
if c.length%2==0
     puts "CHAT WITH HER!"
else

    puts "IGNORE HIM!"
end

name = gets.strip()
if name.size() <= 100
	if name.size() % 2 == 0
		puts "CHAR WITH HER!"
	else
		puts "IGNORE HIM!"
	end
end

name = gets.strip()
if name.size() <= 100
    array_of_characters = name.chars.uniq
	if array_of_characters.size % 2 == 0
		puts "CHAR WITH HER!"
	else
		puts "IGNORE HIM!"
	end
end

puts ["CHAT WITH HER!","IGNORE HIM!"][gets.chars.uniq.size[0]]

puts ["CHAT WITH HER!","IGNORE HIM!"]["ab".chars.uniq.size[0]]

puts gets.chomp.length.even? ? "CHAT WITH HER!" : "IGNORE HIM"

#$stdin=File.open('input.txt')
#$stdout=File.open('output.txt', 'w')
s=gets.to_s
if s.size%2==0 then
puts "CHAT WITH HER!"
else
puts "IGNORE HIM!"
end

#$stdin=File.open('input.txt')
#$stdout=File.open('output.txt', 'w')
s=gets.to_s
if s.size%2!=0 then
puts "CHAT WITH HER!"
else
puts "IGNORE HIM!"
end

p(gets.chomp.split.uniq.size.odd? ? 'IGNORE HIM!' : 'CHAT WITH HER!')

str = gets.chomp.each_char
p(str.take(str.count).size.odd? ? 'IGNORE HIM!' : 'CHAT WITH HER!')

p(gets.chomp.each_char.to_a.uniq.size.odd? ? 'IGNORE HIM!' : 'CHAT WITH HER!')


n = gets.to_i
s = gets.strip
d = Array.new(n + 1) { [Float::INFINITY] * 2 }
d[0][0] = 0
n.times do |i|
  2.times do |j|
    d[i + 1][j] = [d[i + 1][j], d[i][j] + 1].min
  end
  if i + i <= n && s[0, i] == s[i, i]
    d[i + i][1] = [d[i + i][1], d[i][0] + 1].min
  end
end
p d[-1].min

n = gets.to_i
s = gets.chomp
max = 0
for i in 0..n / 2
	max = s[0..i] == s[i + 1..i * 2 + 1] ? i : max
end
puts n - max

n = gets.to_i - 1
s = gets.chomp
max = 0
for i in 0..n / 2
	max = s[i+1..n+1][s[0..i]] != nil ? i : max
end
puts n - max + 1

n = gets.to_i - 1
s = gets.chomp
max = 0
for i in 0..n / 2
	max = s[s[0..i] * 2] != nil ? i : max
end
puts n - max + 1