#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long maxn = 1e6 + 100;
const double inf = 1e40;
long long n, m, k, t;
struct point {
  double first, second;
  point operator-(point other) {
    point ans;
    ans.first = first - other.first;
    ans.second = second - other.second;
    return ans;
  }
};
point L[maxn];
point R[maxn];
double ans = inf;
vector<double> L1;
vector<double> R1;
vector<double> interest;
void solveL(long long l, long long r, long long ansl, long long ansr) {
  if (l > r) {
    return;
  }
  long long q, w;
  long long m = (l + r) / 2;
  double ans = inf;
  long long ansi = ansl;
  for (q = ansl; q <= ansr; q++) {
    double dans = L[q].first + L[q].second * interest[m];
    if (dans < ans) {
      ans = dans;
      ansi = q;
    }
  }
  L1[m] = ans;
  solveL(l, m - 1, ansl, ansi);
  solveL(m + 1, r, ansi, ansr);
}
void solveR(long long l, long long r, long long ansl, long long ansr) {
  if (l > r) {
    return;
  }
  long long q, w;
  long long m = (l + r) / 2;
  double ans = -inf;
  long long ansi = ansl;
  for (q = ansl; q <= ansr; q++) {
    double dans = R[q].first + R[q].second * interest[m];
    if (dans > ans) {
      ans = dans;
      ansi = q;
    }
  }
  R1[m] = ans;
  solveR(l, m - 1, ansl, ansi);
  solveR(m + 1, r, ansi, ansr);
}
bool cmp(point a, point b) { return a.second < b.second; }
double get_val(point diff) {
  double c = -1.0 / diff.second;
  diff.first *= c;
  diff.second *= c;
  return diff.first;
}
vector<pair<double, double> > ban;
bool is_ban(double first) {
  long long i =
      lower_bound(ban.begin(), ban.end(), make_pair(first, (double)0)) -
      ban.begin();
  i--;
  if (i < 0) {
    return 0;
  }
  if (ban[i].second > first) {
    return 1;
  }
  return 0;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout << setprecision(10) << fixed;
  long long q, w, e, a, b, c;
  cin >> n;
  interest.push_back(0);
  vector<point> all;
  for (q = 0; q < n; q++) {
    cin >> a >> b >> c;
    L[q] = {(double)a, (double)c};
    R[q] = {(double)b, (double)c};
    all.push_back(L[q]);
    all.push_back(R[q]);
  }
  for (q = 0; q < n; q++) {
    for (w = q + 1; w < n; w++) {
      if (L[w].second == L[q].second) {
        continue;
      }
      double l = get_val(R[q] - L[w]);
      double r = get_val(R[w] - L[q]);
      if (l > r) {
        swap(l, r);
      }
      ban.push_back(make_pair(l, r));
    }
  }
  double rban = -inf;
  sort(ban.begin(), ban.end());
  vector<pair<double, double> > ban1;
  for (q = 0; q < ban.size(); q++) {
    pair<double, double> p = ban[q];
    if (p.first < rban) {
      ban1.back().second = max(p.second, ban1.back().second);
    } else {
      ban1.push_back(p);
    }
    rban = ban1.back().second;
  }
  ban = ban1;
  for (q = 0; q < all.size(); q++) {
    for (w = q + 1; w < all.size(); w++) {
      if (all[w].second == all[q].second) {
        continue;
      }
      point diff = all[w] - all[q];
      interest.push_back(get_val(diff));
    }
  }
  sort(interest.begin(), interest.end());
  L1.resize(interest.size());
  R1.resize(interest.size());
  sort(&L[0], &L[n], cmp);
  sort(&R[0], &R[n], cmp);
  reverse(&L[0], &L[n]);
  solveL(0, interest.size() - 1, 0, n - 1);
  solveR(0, interest.size() - 1, 0, n - 1);
  double ans = inf;
  for (q = 0; q < interest.size(); q++) {
    if (is_ban(interest[q])) {
      continue;
    }
    ans = min(ans, R1[q] - L1[q]);
  }
  cout << ans;
  return 0;
}
