#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const double eps = 1e-9;
double xl[N], xr[N], second[N], pi = acos(-1), mn_x, mx_x;
int ind_l, ind_r;
double point_pr(double first, double second, double ctg) {
  return first - second * ctg;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  vector<pair<double, int> > q;
  vector<pair<double, pair<int, int> > > events, prom_left, prom_right;
  cin >> n;
  pair<double, double> mx, mn;
  mx = {-1.0, -1.0};
  mn = {2e9, 2e9};
  mn_x = 2e9;
  mx_x = -2e9;
  for (int i = 0; i < n; ++i) {
    cin >> xl[i] >> xr[i] >> second[i];
    if (xl[i] < mn_x) {
      mn_x = xl[i];
    }
    if (xr[i] > mx_x) {
      mx_x = xr[i];
    }
    if (mx.second < second[i]) {
      mx.second = second[i];
      mx.first = xl[i];
      ind_l = i;
    } else if (mx.second == second[i] && mx.first > xl[i]) {
      mx.second = second[i];
      mx.first = xl[i];
      ind_l = i;
    }
    if (mn.second > second[i]) {
      mn.second = second[i];
      mn.first = xl[i];
      ind_r = i;
    } else if (mn.second == second[i] && mn.first < xl[i]) {
      mn.second = second[i];
      mn.first = xl[i];
      ind_r = i;
    }
  }
  double a1, a2;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (second[i] > second[j]) {
        a1 = (xr[i] - xl[j]) / (second[i] - second[j]);
        a2 = (xl[i] - xr[j]) / (second[i] - second[j]);
        q.push_back({a1, 1});
        q.push_back({a2, 2});
        a1 = (xl[i] - xl[j]) / (second[i] - second[j]);
        a2 = (xr[i] - xr[j]) / (second[i] - second[j]);
        events.push_back({a1, {i, j}});
        events.push_back({a2, {-i - 1, j}});
      }
    }
  }
  if (q.empty()) {
    cout << fixed << setprecision(9) << mx_x - mn_x << endl;
    return 0;
  }
  sort(q.rbegin(), q.rend());
  int cnt = 0;
  double last = 0;
  for (auto i : q) {
    if (i.second == 2) {
      --cnt;
      if (!cnt) {
        events.push_back({i.first, {-1e9, -1e9}});
      }
    } else {
      if (!cnt) {
        events.push_back({i.first, {-1e9, -1e9}});
      }
      ++cnt;
    }
  }
  sort(events.rbegin(), events.rend());
  double ans = 1e18, ang;
  last = -1e18;
  for (auto i : events) {
    if (i.second.first == i.second.second) {
      unordered_set<int> s;
      vector<int> to_check;
      for (auto j : prom_left) {
        s.insert(j.second.first);
        if (j.second.first == ind_l) {
          to_check.push_back(j.second.second);
        }
      }
      prom_left.clear();
      for (auto j : to_check) {
        if (!s.count(j)) {
          ind_l = j;
          break;
        }
      }
      s.clear();
      to_check.clear();
      for (auto j : prom_right) {
        s.insert(j.second.second);
        if (j.second.second == ind_r) {
          to_check.push_back(-j.second.first - 1);
        }
      }
      prom_right.clear();
      for (auto j : to_check) {
        if (!s.count(j)) {
          ind_r = j;
          break;
        }
      }
      s.clear();
      to_check.clear();
      double res = point_pr(xr[ind_r], second[ind_r], i.first) -
                   point_pr(xl[ind_l], second[ind_l], i.first);
      if (ans > res) {
        ans = res;
        ang = i.first;
      }
    } else if (i.second.first < 0) {
      if (abs(i.first - last) > eps) {
        unordered_set<int> s;
        vector<int> to_check;
        for (auto j : prom_right) {
          s.insert(j.second.second);
          if (j.second.second == ind_r) {
            to_check.push_back(-j.second.first - 1);
          }
        }
        prom_right.clear();
        for (auto j : to_check) {
          if (!s.count(j)) {
            ind_r = j;
            break;
          }
        }
        s.clear();
        to_check.clear();
      }
      prom_right.push_back(i);
    } else {
      if (abs(i.first - last) > eps) {
        unordered_set<int> s;
        vector<int> to_check;
        for (auto j : prom_left) {
          s.insert(j.second.first);
          if (j.second.first == ind_l) {
            to_check.push_back(j.second.second);
          }
        }
        prom_left.clear();
        for (auto j : to_check) {
          if (!s.count(j)) {
            ind_l = j;
            break;
          }
        }
        s.clear();
        to_check.clear();
      }
      prom_left.push_back(i);
    }
    last = i.first;
  }
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}
