(defn formula [X Y x y]
  (+ (Math/abs (- X x)) (Math/abs (- Y y))))

(def formula (memoize formula))

(defn zero-case [X Y zs]
  (apply min (map (fn [[x y _]] (formula X Y x y)) zs)))

(defn Pyramid [ls]
  (let [{lsn false zs true} (group-by (fn [[_ _ h]] (zero? h)) ls)
        range_it (range 0 101)]
    (first
      (for [X range_it
            Y range_it
            :let [Hs (map (fn [[x y h]] (+ h (formula X Y x y))) lsn)
                  H  (first Hs)]
            :when (and (apply = Hs)
                    (if (nil? zs)
                      (<= 1 H)
                      (>= (zero-case X Y zs) H)))]
        (format "%d %d %d" X Y H)))))

(defn input [N]
  (when-not (zero? N)
    (let [x (int (read)) y (int (read)) h (int (read))]
      (cons [x y h] (input (dec N))))))

(-> (read) int input Pyramid println)