#include <bits/stdc++.h>
using namespace std;
const int maxn = 2009;
struct FS {
  int a, b;
  FS(int _a = 0, int _b = 0) {
    a = _a;
    b = _b;
    if (a < 0) {
      a = -a;
      b = -b;
    }
  }
  bool operator<(const FS &rhs) const {
    return 1LL * b * rhs.a < 1LL * rhs.b * a;
  }
  bool operator==(const FS &rhs) const {
    return 1LL * b * rhs.a == 1LL * rhs.b * a;
  }
};
int nn;
struct event {
  FS t;
  int f;
  bool operator<(const event &rhs) const {
    if (t == rhs.t) return f < rhs.f;
    return t < rhs.t;
  }
} q[maxn * maxn];
int n;
int xl[maxn], xr[maxn], y[maxn];
struct Point {
  int x, y;
  Point(int _x = 0, int _y = 0) {
    x = _x;
    y = _y;
  }
  bool operator<(const Point &rhs) const {
    if (x == rhs.x) return y < rhs.y;
    return x < rhs.x;
  }
};
Point operator-(Point a, Point b) { return Point(a.x - b.x, a.y - b.y); }
long long cross(Point a, Point b) { return 1LL * a.x * b.y - 1LL * b.x * a.y; }
struct ConvexHull {
  int n, top, t;
  Point a[maxn];
  Point b[maxn];
  void Add(int x, int y) { a[++n] = Point(x, y); }
  void work() {
    sort(a + 1, a + 1 + n);
    for (int i = 1; i <= n; ++i) {
      while (top >= 2 && cross(b[top] - b[top - 1], a[i] - b[top - 1]) >= 0)
        --top;
      b[++top] = a[i];
    }
    t = 1;
  }
  double query(double k) {
    while (t + 1 <= top && b[t + 1].y - k * b[t + 1].x >= b[t].y - k * b[t].x)
      ++t;
    return b[t].y - k * b[t].x;
  }
} u, d;
double ans = 1e20;
void check(FS k) {
  double a = 1.0 * k.b / k.a;
  double mx = u.query(-a);
  double mn = -d.query(-a);
  ans = min(ans, mx - mn);
}
void calc(int i, int j) {
  if (y[i] == y[j]) return;
  FS l, r;
  if (y[i] < y[j]) swap(i, j);
  int dx = xl[j] - xr[i], dy = y[j] - y[i];
  l = FS(dy, dx);
  dx = xr[j] - xl[i];
  r = FS(dy, dx);
  if (r < l) swap(l, r);
  q[++nn].t = l;
  q[nn].f = 1;
  q[++nn].t = r;
  q[nn].f = 0;
}
void check2() {
  int mn = 10000000;
  int mx = -10000000;
  for (int i = 1; i <= n; ++i) {
    mn = min(mn, xl[i]);
    mx = max(mx, xr[i]);
  }
  ans = min(ans, 1.0 * mx - mn);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    cin >> xl[i] >> xr[i] >> y[i];
    u.Add(-y[i], xr[i]);
    d.Add(y[i], -xl[i]);
  }
  u.work();
  d.work();
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      calc(i, j);
    }
  }
  sort(q + 1, q + 1 + nn);
  int cnt = 0;
  for (int i = 1; i <= nn; ++i) {
    if (q[i].f == 0) --cnt;
    if (!cnt) check(q[i].t);
    if (q[i].f == 1) ++cnt;
  }
  if (nn == 0) check2();
  printf("%.10f\n", ans);
  return 0;
}
