#include <bits/stdc++.h>
using namespace std;
const double INF = 1e100;
struct PT {
  long long x, y;
  PT() {}
  PT(long long x, long long y) : x(x), y(y) {}
  PT(const PT &p) : x(p.x), y(p.y) {}
  PT operator+(const PT &p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT &p) const { return PT(x - p.x, y - p.y); }
  PT operator*(long long c) const { return PT(x * c, y * c); }
  PT operator/(long long c) const { return PT(x / c, y / c); }
};
long long dot(PT p, PT q) { return p.x * q.x + p.y * q.y; }
long long dist2(PT p, PT q) { return dot(p - q, p - q); }
long long cross(PT p, PT q) { return p.x * q.y - p.y * q.x; }
ostream &operator<<(ostream &os, const PT &p) {
  return os << "(" << p.x << "," << p.y << ")";
}
const int N = 2005;
int l[N], r[N], y[N];
double project(PT O, PT dir) {
  assert(dir.y != 0);
  double d = -1.0 * O.y / dir.y;
  return O.x + d * dir.x;
}
int n;
double check(PT dir, double d) {
  double mx = -1e100, mn = 1e100;
  for (int i = 1; i <= n; i++) {
    PT A(l[i], y[i]), B(r[i], y[i]);
    double a = project(A, dir);
    double b = project(B, dir);
    mx = max(mx, max(a, b));
    mn = min(mn, min(a, b));
    if (mx - mn > d) return INF;
  }
  return mx - mn;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << setprecision(10) << fixed;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> l[i] >> r[i] >> y[i];
  vector<pair<PT, PT>> bad;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (y[i] <= y[j]) continue;
      PT A(l[i], y[i]), B(r[i], y[i]);
      PT C(l[j], y[j]), D(r[j], y[j]);
      PT AD = D - A, BC = C - B;
      assert(cross(BC, AD) > 0);
      bad.push_back({BC, AD});
    }
  }
  if (bad.empty()) {
    PT OY(0, -1);
    cout << check(OY, INF) << endl;
    return 0;
  }
  sort(bad.begin(), bad.end(), [](pair<PT, PT> l, pair<PT, PT> r) {
    return cross(l.first, r.first) > 0;
  });
  vector<pair<PT, PT>> merged;
  for (auto R : bad) {
    if (merged.empty())
      merged.push_back(R);
    else {
      auto cur = merged.back();
      if (cross(cur.second, R.first) >= 0)
        merged.push_back(R);
      else if (cross(cur.second, R.second) >= 0)
        merged.back().second = R.second;
    }
  }
  vector<PT> cands;
  for (auto pr : merged) {
    PT A = pr.first;
    PT B = pr.second;
    cands.push_back(A);
    cands.push_back(B);
  }
  mt19937 rng(2323423);
  shuffle(cands.begin(), cands.end(), rng);
  double ans = INF;
  for (PT X : cands) {
    ans = min(ans, check(X, ans));
  }
  cout << ans << endl;
}
