#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int s = abs(a - b);
    int ans = s / 5;
    s %= 5;
    if (s > 2)
      ans += 2;
    else if (s != 0)
      ans++;
    cout << ans << endl;
  }
  return 0;
}
