#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
int main() {
  int t, a, b;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    int ans;
    if (a > b) swap(a, b);
    ans = (b - a) / 5;
    int x = (b - a) % 5;
    if (x == 1 || x == 2)
      ans += 1;
    else if (x == 3 || x == 4)
      ans += 2;
    cout << ans << "\n";
  }
}
