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