'use strict';

function Main(input) {
  const N = Number(input.split("\n")[0].split(" ")[0]);
  const T = Number(input.split("\n")[0].split(" ")[1]);
  const list = input.split("\n").map(x => x.split(" ").map(y => Number(y)));
  list.shift();
  list.sort((x, y) => (x[3] < y[3] ? -1 : 1));
  let Cx = -1;
  let Cy = -1;
  const checked = [list[0]];

  for(let i = 1; i < N; i++) {
    for(let val of checked) {
      let dif_x = val[0] - list[i][0];
      let dif_y = val[1] - list[i][1];
      let dif_h = val[2] - list[i][2];

      if(dif_h === 0 && dif_x === 0) {
        Cy = (val[1] + list[i][1]) / 2;
      }
      if(dif_h === 0 && dif_y === 0) {
        Cx = (val[0] + list[i][0]) / 2;
      }
      if(Cx !== -1 && Cy !== -1) {
        break;
      }
    }
    if(Cx !== -1 && Cy !== -1) {
      break;
    }
    checked.push(list[i]);
  }
  

  const H = list[0][2] + Math.abs(Cx - list[0][0]) + Math.abs(Cy - list[0][1]);

  console.log(Cx + " " + Cy + " " + H);

};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
