#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
void solve() {
  int a, b;
  cin >> a >> b;
  int diff = abs(a - b);
  int count = 0;
  count += (diff / 5);
  diff %= 5;
  if (diff == 1 || diff == 2)
    ++count;
  else if (diff == 3 || diff == 4)
    count += 2;
  cout << count << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
