#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
int n, t;
struct arr {
  double x, s, w;
  int p;
};
arr v[12];
bool cmp(arr a, arr b) { return a.x < b.x; }
bool cmp2(arr a, arr b) { return a.p < b.p; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> t;
  double t2 = 0.0 + t;
  for (int i = 1; i <= n; ++i) {
    int x, s, w;
    cin >> x >> s >> w;
    v[i] = {0.0 + x, 0.0 + s, 0.0 + w};
    v[i].p = i;
  }
  sort(v + 1, v + n + 1, cmp);
  double tt = 0.0;
  int ps = 0;
  int lca = 0, lcb = 0;
  while (tt < t2) {
    ++ps;
    double mint = 102.00;
    int x = 0, y = 0;
    for (int i = 1; i < n; ++i) {
      if (v[i].x == v[i + 1].x) continue;
      if (v[i].s > 0 && v[i + 1].s > 0) {
        double ttt = (v[i + 1].x - v[i].x) / (v[i].s - v[i + 1].s);
        if (ttt > 0.00 && ttt < mint) mint = ttt, x = i, y = i + 1;
      }
      if (v[i].s < 0 && v[i + 1].s < 0) {
        double ttt = (v[i + 1].x - v[i].x) / (v[i].s - v[i + 1].s);
        if (ttt > 0.00 && ttt < mint) mint = ttt, x = i, y = i + 1;
      }
      if (v[i].s > 0.0 && v[i + 1].s < 0.0) {
        double ttt = (v[i + 1].x - v[i].x) / (v[i].s - v[i + 1].s);
        if (ttt > 0.00 && ttt < mint) mint = ttt, x = i, y = i + 1;
      }
    }
    if (tt + mint >= t) mint = t - tt;
    for (int i = 1; i <= n; ++i) v[i].x += v[i].s * mint;
    for (int i = 1; i < n; ++i) {
      if (v[i].x == v[i + 1].x) {
        x = i, y = i + 1;
        double v1 = v[x].s;
        double v2 = v[y].s;
        v[x].s = ((v[x].w - v[y].w) * v1 + 2.0000 * v[y].w * v2) /
                 (0.00 + v[x].w + v[y].w);
        v[y].s = ((v[y].w - v[x].w) * v2 + 2.0000 * v[x].w * v1) /
                 (0.00 + v[x].w + v[y].w);
      }
    }
    lca = x, lcb = y;
    tt += mint;
  }
  sort(v + 1, v + n + 1, cmp2);
  for (int i = 1; i <= n; ++i)
    cout << fixed << setprecision(12) << v[i].x << '\n';
  return 0;
}
