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

class Program
{
    static void Main()
    {
        var n = ReadInts()[0];
        var pl = new PyramidFilter();
        for (int i = 0; i < n; i++)
        {
            var nums = ReadInts();
            pl.Add(nums[0], nums[1], nums[2]);
        }


        Console.WriteLine(pl.GetLeft());
    }

    static void Replace(char[] arr, char a, char b)
    {
        for (int i = 0; i < arr.Length; i++)
        {
            if (arr[i] == a)
                arr[i] = b;
            else if (arr[i] == b)
                arr[i] = a;
        }
    }

    #region Utils
    static int[] ReadInts()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    #endregion
}

static class Utils
{
    public static int FindFirstIndex<T>(IList<T> source, Func<T, bool>func, int start)
    {
        for (int i = start; i < source.Count; i++)
        {
            if (func(source[i]))
            {
                var ret = source[i];
                return i;
            }
        }
        return -1;
    }

    public static bool IsInRange(this double val,double low ,double high)
    {
        return low <= val && val <= high;
    }
}


class PyramidFilter
{
    public struct Data
    {
        public Data(int x, int y, int h)
        {
            X = x;
            Y = y;
            H = h;
        }

        public int X { get; }
        public int Y { get; }
        public int H { get; }

        public override string ToString()
        {
            return $"{X} {Y} {H}";
        }
    }

    private Data[] _left;

    private readonly List<Data> _unFilted = new List<Data>();
    public Data GetLeft()
    {
       var f = _unFilted.FirstOrDefault(p => p.H > 0);
        if (f.H > 0)
            return _unFilted.Aggregate(FirstData(f), (p, q) => Filter(p, q)).First();
        else
            return new Data(100 * 5050 - _unFilted.Sum(p => p.X), 100 * 5050 - _unFilted.Sum(p => p.Y), 1);
    }

    public void Add(int x, int y, int h)
    {
        Add(new Data(x, y, h));
    }

    private void Add(Data data)
    {
        _unFilted.Add(data);
    }

    static private IEnumerable<Data> Filter(IEnumerable<Data> source, Data d)
    {
        return source.Where(p => d.H == Math.Max(p.H - Distance(p, d), 0));
    }
    static private IEnumerable<Data> FirstData()
    {
        return FirstData(new Data(-1, -1, -1));
    }
    static private IEnumerable<Data> FirstData(Data a)
    {
        const int num = 100;
        for (int x = 0; x <= num; x++)
        {
            for (int y = 0; y <= num; y++)
            {
                if (a.H < 0)
                    yield return new Data(x, y, 0);
                else
                {
                    var ha = Distance(x, y, a.X, a.Y) + a.H;
                    yield return new Data(x, y, ha);
                }
            }
        }
    }

    private static int Distance(Data a, Data b)
    {
        return Distance(a.X, a.Y, b.X, b.Y);
    }
    private static int Distance(int x1, int y1, int x2, int y2)
    {
        return Math.Abs(x1 - x2) + Math.Abs(y1 - y2);
    }
}

class DescendingComparetor<T> : IComparer<T>
{
    public static IComparer<T> Instance { get; } = new DescendingComparetor<T>();
    private DescendingComparetor()
    {
    }
    public int Compare(T x, T y)
    {
        return Comparer<T>.Default.Compare(y, x);
    }

}

struct Vector
{

    public double X { get; }
    public double Y { get; }


    private double? _grad;
    public double Grad
    {
        get
        {
            if (_grad == null)
            {
                double sin = Y;
                double cos = X;

                var temp = Math.Atan2(sin, cos) * (180 / Math.PI);
                _grad = temp;
            }
            return _grad.Value;
        }
    }


    private double? _length;

    public Vector(double x, double y) : this()
    {
        X = x;
        Y = y;
    }

    public double Length
    {
        get
        {
            if (_length == null)
                _length = Math.Sqrt(X * X + Y * Y);
            return _length.Value;
        }
    }


    public static Vector operator +(Vector a, Vector b)
    {
        return new Vector(a.X + b.X, a.Y + b.Y);
    }
}

Measured memory_bytes: 13524