#include <bits/stdc++.h>
using namespace std;
double min(double a, double b) { return a < b ? a : b; }
int n;
struct pl {
  int idx;
  double x, v, m;
} p[12], tp[12];
int eq(double a, double b) {
  if (fabs(a - b) < 1e-7)
    return 1;
  else
    return 0;
}
double get() {
  int i;
  double ret = -1;
  double t, x;
  for (i = 0; i < n - 1; i++) {
    if (p[i].v > p[i + 1].v) {
      t = (p[i].x - p[i + 1].x) / (p[i + 1].v - p[i].v);
      if (ret == -1)
        ret = t;
      else
        ret = min(ret, t);
    }
  }
  return ret;
}
int mark[12];
void done(double t) {
  int i;
  for (i = 0; i < n; i++) mark[i] = 0;
  for (i = 0; i < n; i++) {
    tp[i].x = p[i].x + p[i].v * t;
    tp[i].m = p[i].m;
    tp[i].idx = p[i].idx;
  }
  for (i = 0; i < n - 1; i++) {
    if (!mark[i]) {
      if (eq(tp[i].x, tp[i + 1].x)) {
        mark[i] = 1;
        mark[i + 1] = 1;
        tp[i].v =
            ((p[i].m - p[i + 1].m) * p[i].v + 2 * p[i + 1].m * p[i + 1].v) /
            (p[i].m + p[i + 1].m);
        tp[i + 1].v =
            ((p[i + 1].m - p[i].m) * p[i + 1].v + 2 * p[i].m * p[i].v) /
            (p[i].m + p[i + 1].m);
      } else {
        mark[i] = 1;
        tp[i].v = p[i].v;
      }
    }
  }
  if (!mark[i]) {
    mark[i] = 1;
    tp[i].v = p[i].v;
  }
  for (i = 0; i < n; i++) {
    p[i] = tp[i];
  }
}
int cmp(pl a, pl b) { return a.x < b.x; }
int cmpp(pl a, pl b) { return a.idx < b.idx; }
int main() {
  int i, j, r1, r2, k;
  double t;
  while (scanf("%d %lf", &n, &t) == 2) {
    for (i = 0; i < n; i++) {
      scanf("%lf %lf %lf", &p[i].x, &p[i].v, &p[i].m);
      p[i].idx = i;
    }
    sort(p, p + n, cmp);
    if (n == 1) {
      printf("%lf\n", p[0].x + (p[0].v) * t);
      continue;
    }
    double nt = 0, thent;
    while (nt < t) {
      thent = get();
      if (thent == -1) {
        done(t - nt);
        nt = t + 1;
      } else {
        if ((nt + thent) < t) {
          done(thent);
          nt += thent;
        } else {
          done(t - nt);
          nt = t + 1;
        }
      }
    }
    sort(p, p + n, cmpp);
    for (i = 0; i < n; i++) {
      printf("%.9lf\n", p[i].x);
    }
  }
}
