#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b;
  cin >> a >> b;
  long long ans = abs(a - b) / 5;
  a = abs(a - b) % 5;
  if (a == 4) cout << ans + 2;
  if (a == 3) cout << ans + 2;
  if (a == 2) cout << ans + 1;
  if (a == 1) cout << ans + 1;
  if (a == 0) cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  cin.get();
  return 0;
}
