#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long int a, b, c, k, ans = 0;
    cin >> a >> b;
    c = abs(a - b);
    while (c > 0) {
      if (c >= 5) {
        k = c / 5;
        ans += k;
        c = c - k * 5;
      } else if (c >= 2) {
        k = c / 2;
        ans += k;
        c = c - k * 2;
      } else if (c >= 1) {
        k = c / 1;
        ans += k;
        c = c - k * c;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
