using System.Linq;
using System.Collections.Generic;
using System;

public class hello
{
    public static bool[,,,,,] visited;
    public static void Main()
    {
        visited = new bool[50, 16, 16, 16, 16, 16];
        var n = int.Parse(Console.ReadLine().Trim());
        var pr = new int[n, 4];
        var p = 0;
        var d = new Dictionary<int, int>();
        var h = new Dictionary<string, int>();
        var hp = 16;
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            d[int.Parse(line[0])] = p;
            if (line[1] == "IF")
            {
                pr[p, 0] = 3;
                if (h.ContainsKey(line[2])) pr[p, 1] = h[line[2]];
                else
                {
                    h[line[2]] = hp++;
                    pr[p, 1] = h[line[2]];
                }
                pr[p, 2] = int.Parse(line[3]);
            }
            else if (line[1] == "HALT") pr[p, 0] = 4;
            else if (line[1] == "SET")
            {
                pr[p, 0] = 2;
                if (h.ContainsKey(line[2])) pr[p, 1] = h[line[2]];
                else
                {
                    h[line[2]] = hp++;
                    pr[p, 1] = h[line[2]];
                }
                int tw;
                if (int.TryParse(line[3], out tw)) pr[p, 2] = tw;
                else
                {
                    if (h.ContainsKey(line[3])) pr[p, 2] = h[line[3]];
                    else
                    {
                        h[line[3]] = hp++;
                        pr[p, 2] = h[line[3]];
                    }
                }
            }
            else
            {
                pr[p, 0] = line[1] == "ADD" ? 0 : 1;
                if (h.ContainsKey(line[2])) pr[p, 1] = h[line[2]];
                else
                {
                    h[line[2]] = hp++;
                    pr[p, 1] = h[line[2]];
                }
                if (h.ContainsKey(line[3])) pr[p, 2] = h[line[3]];
                else
                {
                    h[line[3]] = hp++;
                    pr[p, 2] = h[line[3]];
                }
                int tw;
                if (int.TryParse(line[4], out tw)) pr[p, 3] = tw;
                else
                {
                    if (h.ContainsKey(line[4])) pr[p, 3] = h[line[4]];
                    else
                    {
                        h[line[4]] = hp++;
                        pr[p, 3] = h[line[4]];
                    }
                }
            }
            p++;
        }
        for (int i = 0; i < n; i++)
            if (pr[i, 0] == 3 && d.ContainsKey(pr[i, 2])) pr[i, 2] = d[pr[i, 2]];
        goSim(n, pr, h);
    }
    static void goSim(int n, int[,] pr, Dictionary<string, int> h)
    {
        var ha = new Dictionary<int, int>();
        for (int i = 0; i < 5; i++) ha[i + 16] = 0;
        var used = new List<int>[n];
        for (int i = 0; i < n; i++) used[i] = new List<int>();
        var p = 0;
        while (p < n)
        {
            var cmd = pr[p, 0];
            if (cmd == 0 && pr[p, 3] <= 15)
            {
                if (ha[pr[p, 2]] + pr[p, 3] >= 16) { pend(h, ha); return; }
                else ha[pr[p, 1]] = ha[pr[p, 2]] + pr[p, 3];
            }
            else if (cmd == 0 && pr[p, 3] >= 16)
            {
                if (ha[pr[p, 2]] + ha[pr[p, 3]] >= 16) { pend(h, ha); return; }
                else ha[pr[p, 1]] = ha[pr[p, 2]] + ha[pr[p, 3]];
            }
            else if (cmd == 1 && pr[p, 3] <= 15)
            {
                if (ha[pr[p, 2]] - pr[p, 3] < 0) { pend(h, ha); return; }
                else ha[pr[p, 1]] = ha[pr[p, 2]] - pr[p, 3];
            }
            else if (cmd == 1 && pr[p, 3] >= 16)
            {
                if (ha[pr[p, 2]] - ha[pr[p, 3]] < 0) { pend(h, ha); return; }
                else ha[pr[p, 1]] = ha[pr[p, 2]] - ha[pr[p, 3]];
            }
            else if (cmd == 2 && pr[p, 2] <= 15) ha[pr[p, 1]] = pr[p, 2];
            else if (cmd == 2 && pr[p, 2] >= 16) ha[pr[p, 1]] = ha[pr[p, 2]];
            else if (cmd == 3)
            {
                if (ha[pr[p, 1]] != 0)
                {
                    p = pr[p, 2];
                    if (p < n) goto exit;
                    else { pend(h, ha); return; }
                }
            }
            else { pend(h, ha); return; }
            if (visited[p, ha[16], ha[17], ha[18], ha[19], ha[20]]) { Console.WriteLine("inf"); return; }
            else visited[p, ha[16], ha[17], ha[18], ha[19], ha[20]] = true;
            p++;
        exit:;
        }
        pend(h, ha);
    }
    static void pend(Dictionary<string, int> h, Dictionary<int, int> ha)
    {
        foreach (var x in h.OrderBy(y => y.Key))
            Console.WriteLine("{0}={1}", x.Key, ha[x.Value]);
    }
}



Measured memory_bytes: 70276