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