#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> SEG;
vector<pair<double, double>> L;
vector<double> LC;
bool comp_slp(pair<double, double> a, pair<double, double> b) {
  return a.first < b.first;
}
vector<vector<int>> P, CXR, CXL;
int refx, refy;
bool comp_ang(vector<int> a, vector<int> b) {
  long long dxa = a[0] - refx, dxb = b[0] - refx, dya = a[1] - refy,
            dyb = b[1] - refy, dya_dxb = dya * dxb, dyb_dxa = dyb * dxa;
  return dya_dxb < dyb_dxa || (dya_dxb == dyb_dxa && a[0] < b[0]);
}
int main() {
  SEG.clear();
  L.clear();
  LC.clear();
  int n, xl, xr, y;
  double slp1, slp2;
  int rblx = 1000000, rbly = 1000000, lblx, lbly;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> xl >> xr >> y;
    SEG.push_back(vector<int>({xl, xr, y}));
    if (rbly > y || (rbly == y && rblx > xr))
      rbly = lbly = y, rblx = xr, lblx = xl;
  }
  if (n == 1) {
    cout << SEG[0][1] - SEG[0][0] << "\n";
    return 0;
  }
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++) {
      if (SEG[i][2] == SEG[j][2]) continue;
      slp1 = (double)(SEG[i][0] - SEG[j][1]) / (double)(SEG[i][2] - SEG[j][2]);
      slp2 = (double)(SEG[i][1] - SEG[j][0]) / (double)(SEG[i][2] - SEG[j][2]);
      L.push_back(pair<double, double>(min(slp1, slp2), max(slp1, slp2)));
    }
  if (!L.size()) {
    int minx = 1000000, maxx = -1000000;
    for (int i = 0; i < n; i++)
      minx = min(minx, SEG[i][0]), maxx = max(maxx, SEG[i][1]);
    cout << maxx - minx << "\n";
    return 0;
  }
  sort(L.begin(), L.end(), comp_slp);
  double sx = L[0].first, ex = L[0].second;
  int m = L.size();
  for (int i = 1; i < m; i++) {
    if (L[i].first < ex)
      ex = max(ex, L[i].second);
    else {
      LC.push_back(sx);
      LC.push_back(ex);
      sx = L[i].first;
      ex = L[i].second;
    }
  }
  LC.push_back(sx);
  LC.push_back(ex);
  m = LC.size();
  P.clear();
  for (int i = 0; i < n; i++)
    if (SEG[i][1] != rblx || SEG[i][2] != rbly)
      P.push_back(vector<int>({SEG[i][1], SEG[i][2]}));
  refx = rblx, refy = rbly;
  sort(P.begin(), P.end(), comp_ang);
  CXR.clear();
  CXR.push_back(vector<int>({refx, refy}));
  for (int i = 0; i < P.size(); i++) {
    int x = P[i][0], y = P[i][1], tx, ty, bx, by;
    long long dxt, dxb, dyt, dyb;
    while (CXR.size() > 1) {
      tx = CXR[CXR.size() - 1][0], ty = CXR[CXR.size() - 1][1];
      bx = CXR[CXR.size() - 2][0], by = CXR[CXR.size() - 2][1];
      dxt = x - tx, dyt = y - ty;
      dxb = tx - bx, dyb = ty - by;
      if (dyb * dxt >= dyt * dxb)
        CXR.pop_back();
      else
        break;
    }
    CXR.push_back(vector<int>({P[i][0], P[i][1]}));
  }
  P.clear();
  for (int i = 0; i < n; i++)
    if (SEG[i][0] != lblx || SEG[i][2] != lbly)
      P.push_back(vector<int>({SEG[i][0], SEG[i][2]}));
  refx = lblx, refy = lbly;
  sort(P.begin(), P.end(), comp_ang);
  CXL.clear();
  CXL.push_back(vector<int>({refx, refy}));
  for (int i = 0; i < P.size(); i++) {
    int x = P[i][0], y = P[i][1], tx, ty, bx, by;
    long long dxt, dxb, dyt, dyb;
    while (CXL.size() > 1) {
      tx = CXL[CXL.size() - 1][0], ty = CXL[CXL.size() - 1][1];
      bx = CXL[CXL.size() - 2][0], by = CXL[CXL.size() - 2][1];
      dxt = x - tx, dyt = y - ty;
      dxb = tx - bx, dyb = ty - by;
      if (dyb * dxt >= dyt * dxb)
        CXL.pop_back();
      else
        break;
    }
    CXL.push_back(vector<int>({P[i][0], P[i][1]}));
  }
  CXL.push_back(vector<int>({refx, refy}));
  int lefti, righti;
  lefti = CXL.size() - 1;
  for (righti = CXR.size() - 1; righti && CXR[righti][1] <= CXR[righti - 1][1];
       righti--)
    ;
  double leftm, rightm, nxtleftm, nxtrightm, ans = 1e13;
  for (int i = 0; i < m; i++) {
    while (lefti) {
      leftm = CXL[lefti][0] - CXL[lefti][1] * LC[i];
      nxtleftm = CXL[lefti - 1][0] - CXL[lefti - 1][1] * LC[i];
      if (leftm > nxtleftm)
        lefti--;
      else
        break;
    }
    while (righti) {
      rightm = CXR[righti][0] - CXR[righti][1] * LC[i];
      nxtrightm = CXR[righti - 1][0] - CXR[righti - 1][1] * LC[i];
      if (rightm < nxtrightm)
        righti--;
      else
        break;
    }
    leftm = CXL[lefti][0] - CXL[lefti][1] * LC[i];
    rightm = CXR[righti][0] - CXR[righti][1] * LC[i];
    ans = min(ans, rightm - leftm);
  }
  cout.precision(12);
  cout << ans << "\n";
  return 0;
}
