#include <bits/stdc++.h>
using namespace std;
void solve() {
  int a, b;
  cin >> a >> b;
  if (a > b) {
    swap(a, b);
  }
  int diff = b - a;
  vector<int> dc{0, 1, 1, 2, 2};
  if (diff == 0)
    cout << 0 << endl;
  else if (diff < 5) {
    cout << dc[diff] << endl;
  } else {
    int r = diff % 5;
    int q = diff / 5;
    if (r == 0) {
      cout << q << endl;
    } else {
      int n1 = 5 * q;
      int n2 = 5 * (q + 1);
      if (b - (a + n1) < (a + n2) - b) {
        cout << (q + dc[b - (a + n1)]) << endl;
      } else {
        cout << (q + 1 + dc[(a + n2) - b]) << endl;
      }
    }
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
