#include <bits/stdc++.h>
using namespace std;
int t, a, b;
void fn() {
  cin >> a >> b;
  if (a < b) swap(a, b);
  a -= b;
  int ans = a / 5;
  a %= 5;
  if (a == 1 || a == 2)
    ans++;
  else if (a == 3 || a == 4)
    ans += 2;
  cout << ans << endl;
}
int main() {
  cin >> t;
  while (t--) fn();
  return 0;
}
