def valid(n)
  0 <= n && n < 16
end

N = gets.to_i
S = N.times.map{gets.chomp.split} + [[-100, "HALT"]]
I = S.each.with_index.with_object(Hash.new){|(s, i), obj| obj[s[0]] = i}

var = Hash.new
S.each do |s|
  case s[1]
    when "HALT"
    when "IF"
      var[s[2]] = 0
    when "SET"
      var[s[2]] = var[s[3]] = 0
    else
      var[s[2]] = var[s[3]] = var[s[4]] = 0
  end
end
16.times do |i|
  var[i.to_s] = i
end

cnt = 0
i = 0
loop do
  cnt += 1
  if 100000000 < cnt
    puts "inf"
    exit
  end
  s = S[i]
  i += 1
  case s[1]
    when "HALT"
      break
    when "SET"
      var[s[2]] = var[s[3]]
    when "ADD"
      break unless valid(var[s[3]] + var[s[4]])
      var[s[2]] = var[s[3]] + var[s[4]]
    when "SUB"
      break unless valid(var[s[3]] - var[s[4]])
      var[s[2]] = var[s[3]] - var[s[4]]
    when "IF"
      break unless I.key?(s[3])
      i = I[s[3]] unless var[s[2]].zero?
  end
end

16.times do |i|
  var.delete(i.to_s)
end
puts var.sort.map{|a| a*"="}