#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, f, z, t;
  cin >> a;
  for (b = 0; b < a; b++) {
    cin >> c >> d;
    e = max(c - d, d - c);
    f = e / 5;
    f = f + (e % 5) / 2;
    f = f + (e % 5) % 2;
    cout << f << endl;
  }
}
