#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<int> adj[1000001];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int x = abs(n - m);
    int ans = 0;
    ans += (x / 5);
    x = x % 5;
    ans += (x / 2);
    x = x % 2;
    ans += (x / 1);
    x = x % 1;
    cout << ans << endl;
  }
}
