#include <bits/stdc++.h>
const int inf = 1000000000;
using namespace std;
int n, t;
double x[20], v[20], m[20], tekt;
double dmg(int i, int j) {
  double v1, v2;
  v1 = ((m[i] - m[j]) * v[i] + 2 * m[j] * v[j]) / (m[i] + m[j]);
  v2 = ((m[j] - m[i]) * v[j] + 2 * m[i] * v[i]) / (m[j] + m[i]);
  v[i] = v1;
  v[j] = v2;
}
int main() {
  cin >> n >> t;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> v[i] >> m[i];
  }
  tekt = 0;
  while (tekt < t) {
    double mint = inf;
    int mini, minj;
    for (int i = 0; i < n; ++i)
      for (int j = i + 1; j < n; ++j) {
        double time;
        if (v[j] - v[i] == 0) continue;
        time = (x[i] - x[j]) / (v[j] - v[i]);
        if (time <= 0)
          continue;
        else {
          if (time < mint) mint = time, mini = i, minj = j;
        }
      }
    if (mint == inf)
      break;
    else {
      if (tekt + mint > t) break;
      for (int i = 0; i < n; ++i) {
        if (i == mini || i == minj) continue;
        x[i] = x[i] + v[i] * mint;
      }
      x[mini] = x[minj] = x[mini] + v[mini] * mint;
      dmg(mini, minj);
      tekt += mint;
      for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
          if (mini != i && minj != j)
            if (x[i] - x[j] == 0) dmg(i, j);
    }
  }
  if (tekt < t)
    for (int i = 0; i < n; ++i) x[i] = x[i] + v[i] * (t - tekt);
  for (int i = 0; i < n; ++i) printf("%f\n", x[i]);
  return 0;
}
