#include <bits/stdc++.h>
#pragma GCC optimize("fast-math")
using namespace std;
const double INF = 1e18 + 239;
const long long N = 1e8 + 239;
struct Point {
  long long x, y;
  Point() {
    x = 0;
    y = 0;
  }
  Point(long long x_, long long y_) {
    x = x_;
    y = y_;
  }
  long long operator*(const Point &other) const {
    return x * other.y - y * other.x;
  }
  Point operator-(const Point &other) const {
    return Point(x - other.x, y - other.y);
  }
};
bool operator<(const Point &a, const Point &b) { return (a * b) > 0; }
struct Line {
  double f;
  double s;
  double eval(double x) { return f + s * x; }
  Line(long long f_, long long s_) {
    f = f_;
    s = s_;
  }
  Line(){};
};
struct Vert {
  Vert *l;
  Vert *r;
  Line x;
  Vert() {
    l = nullptr;
    r = nullptr;
    x = Line();
  }
  Vert(Line x_) {
    l = nullptr;
    r = nullptr;
    x = x_;
  }
};
struct ChMax {
  Vert *root = nullptr;
  Vert *add(Vert *v, double l, double r, Line cur) {
    if (v == nullptr) {
      v = new Vert(cur);
      return v;
    } else {
      double m = (l + r) / 2;
      bool left = (v->x).eval(l) < (cur).eval(l);
      bool mid = (v->x).eval(m) < (cur).eval(m);
      if (mid) {
        swap(v->x, cur);
      }
      if (l + 1 == r) return v;
      if (left == mid) {
        v->r = add(v->r, m, r, cur);
      } else {
        v->l = add(v->l, l, m, cur);
      }
      return v;
    }
  }
  void fm(Vert *v, double l, double r, double x, double &ans) {
    if (v == nullptr) return;
    ans = max(ans, (v->x).eval(x));
    double m = (r + l) / 2;
    if (x < m)
      fm(v->l, l, m, x, ans);
    else
      fm(v->r, m, r, x, ans);
  }
  double solve(double x) {
    assert(-N < x && x < N);
    double ans = -INF;
    fm(root, -N, N, x, ans);
    return ans;
  }
  void clear() { root = nullptr; }
  void add(double f, double s) {
    Line c(f, s);
    root = add(root, -N, N, c);
  }
};
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  double ans = INF;
  long long n;
  cin >> n;
  vector<pair<Point, Point>> a(n);
  for (long long i = 0; i < n; i++) {
    long long xl, xr, y;
    cin >> xl >> xr >> y;
    a[i].first = Point(xl, y);
    a[i].second = Point(xr, y);
  }
  ChMax MX;
  ChMax MN;
  for (long long i = 0; i < n; i++) {
    MX.add(a[i].first.x, a[i].first.y);
    MX.add(a[i].second.x, a[i].second.y);
    MN.add(-a[i].first.x, -a[i].first.y);
    MN.add(-a[i].second.x, -a[i].second.y);
  }
  long long c_rel = 0;
  Point max_rel;
  auto relax = [&](Point v) {
    if (c_rel == 0 || max_rel < v) {
      long long A = v.x;
      long long B = v.y;
      double mn = INF;
      double mx = -INF;
      mx = MX.solve(-(double)A / (double)B);
      mn = -MN.solve(-(double)A / (double)B);
      ans = min(ans, mx - mn);
      c_rel++;
      max_rel = v;
    }
  };
  Point v0, v3;
  vector<pair<Point, long long>> ev;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (a[i].first.y <= a[j].first.y) continue;
      vector<Point> v;
      v0 = a[i].first - a[j].first;
      v3 = a[i].first - a[j].first;
      v0 = min(v0, a[i].first - a[j].second);
      v0 = min(v0, a[i].second - a[j].first);
      v0 = min(v0, a[i].second - a[j].second);
      v3 = max(v3, a[i].first - a[j].second);
      v3 = max(v3, a[i].second - a[j].first);
      v3 = max(v3, a[i].second - a[j].second);
      if (v0 * v3 != 0) {
        ev.push_back({v0, i + 1});
        ev.push_back({v3, -(i + 1)});
      }
    }
  }
  sort(ev.begin(), ev.end());
  vector<long long> cnt(n + 1);
  long long bad = 0;
  for (auto [ag, tp] : ev) {
    if (!bad) relax(ag);
    if (tp > 0) {
      tp = abs(tp);
      tp--;
      bad -= (cnt[tp] > 0);
      cnt[tp]++;
      bad += (cnt[tp] > 0);
    } else {
      tp = abs(tp);
      tp--;
      bad -= (cnt[tp] > 0);
      cnt[tp]--;
      bad += (cnt[tp] > 0);
    }
    if (!bad) relax(ag);
  }
  if (ev.empty()) {
    relax(Point(0, -1));
  }
  cout << fixed << setprecision(6);
  cout << ans << endl;
}
