#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio();
  cin.tie();
  int t, n, a, b;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int c = abs(a - b);
    int ans = 0;
    int tmp = c / 5;
    ans += tmp;
    c -= tmp * 5;
    tmp = c / 2;
    ans += tmp;
    c -= tmp * 2;
    tmp = c / 1;
    ans += tmp;
    c -= tmp * 1;
    cout << ans << endl;
  }
  return 0;
}
