#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long N = 1e5, alp = 26;
const long double pi = 3.14159265358979;
long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); }
struct ot {
  long long l, r, y;
};
long double pr(long long x, long long y, long long vx, long long vy) {
  return (long double)(vx * (-y)) / vy + x;
}
struct point {
  long long x, y;
};
long long operator*(point a, point b) { return a.x * b.y - a.y * b.x; }
bool operator==(point a, point b) { return a.x == b.x && a.y == b.y; }
bool operator<(point a, point b) { return a * b > 0; }
point operator-(point a, point b) { return {a.x - b.x, a.y - b.y}; }
long long find_id(vector<point>& v, point u) {
  long long l = 0, r = v.size() - 1;
  while (r - l > 1) {
    long long m = (l + r) / 2;
    if (v[m] * u >= 0)
      l = m;
    else
      r = m;
  }
  if (v[l] * u == 0) return l;
  return r;
}
point norm(point v) {
  long long g = gcd(abs(v.x), abs(v.y));
  v.x /= g;
  v.y /= g;
  return v;
}
long double ans(vector<ot>& a, point v) {
  long double l = 1e18, r = -1e18;
  for (long long i = 0; i < a.size(); ++i) {
    l = min(l, pr(a[i].l, a[i].y, v.x, v.y));
    r = max(r, pr(a[i].r, a[i].y, v.x, v.y));
  }
  return r - l;
}
bool cmp(point a, point b) {
  if (a.y != b.y) return a.y > b.y;
  return b.x > a.x;
}
vector<point> obol(vector<point> v) {
  long long n = v.size();
  sort(v.begin(), v.end(), cmp);
  vector<point> s;
  s.push_back(v[0]);
  for (long long i = 1; i < n; ++i) {
    while (s.size() > 1 &&
           (s.back() - s[s.size() - 2]) * (v[i] - s.back()) <= 0)
      s.pop_back();
    s.push_back(v[i]);
  }
  return s;
}
vector<point> obol2(vector<point> v) {
  long long n = v.size();
  for (long long i = 0; i < n; ++i) v[i].x *= -1;
  auto s = obol(v);
  for (long long i = 0; i < s.size(); ++i) s[i].x *= -1;
  return s;
}
long double ans(vector<point>& o1, vector<point> o2, point v) {
  long long l = 0, r = o1.size() - 1;
  while (r - l > 1) {
    long long m = (l + r) / 2;
    if ((o1[m + 1] - o1[m]) * v >= 0)
      l = m;
    else
      r = m;
  }
  long double left =
      min(pr(o1[l].x, o1[l].y, v.x, v.y), pr(o1[r].x, o1[r].y, v.x, v.y));
  l = 0, r = o2.size() - 1;
  while (r - l > 1) {
    long long m = (l + r) / 2;
    if ((o2[m + 1] - o2[m]) * v <= 0)
      l = m;
    else
      r = m;
  }
  long double right =
      max(pr(o2[l].x, o2[l].y, v.x, v.y), pr(o2[r].x, o2[r].y, v.x, v.y));
  return right - left;
}
void solve() {
  cout << fixed << setprecision(20);
  long long n;
  cin >> n;
  vector<ot> a(n);
  set<long long> y;
  for (long long i = 0; i < n; ++i)
    cin >> a[i].l >> a[i].r >> a[i].y, y.insert(a[i].y);
  if (y.size() == 1) {
    long long mn = 1e18, mx = -1e18;
    for (long long i = 0; i < n; ++i)
      mn = min(mn, a[i].l), mx = max(mx, a[i].r);
    cout << mx - mn;
    return;
  }
  vector<point> v;
  for (long long i = 0; i < n; ++i)
    for (long long j = 0; j < n; ++j)
      if (a[i].y > a[j].y) {
        v.push_back({a[j].r - a[i].l, a[j].y - a[i].y});
        v.push_back({a[j].l - a[i].r, a[j].y - a[i].y});
      }
  sort(v.begin(), v.end());
  for (long long i = 0; i < v.size(); ++i) v[i] = norm(v[i]);
  v.resize(unique(v.begin(), v.end()) - v.begin());
  vector<long long> pr(v.size(), 0);
  for (long long i = 0; i < n; ++i)
    for (long long j = 0; j < n; ++j)
      if (a[i].y > a[j].y) {
        long long r = find_id(v, {a[j].r - a[i].l, a[j].y - a[i].y});
        long long l = find_id(v, {a[j].l - a[i].r, a[j].y - a[i].y});
        if (l < r) ++pr[l + 1], --pr[r];
      }
  for (long long i = 1; i < v.size(); ++i) pr[i] += pr[i - 1];
  vector<point> al;
  for (auto x : a) al.push_back({x.l, x.y}), al.push_back({x.r, x.y});
  auto o1 = obol(al);
  auto o2 = obol2(al);
  long double mn = 1e18;
  for (long long i = 0; i < v.size(); ++i)
    if (!pr[i]) {
      mn = min(mn, ans(o1, o2, v[i]));
    }
  cout << mn;
}
int32_t main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
}
