#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, e, i, j, x, y, n;
  cin >> n;
  while (n--) {
    cin >> a >> b;
    if (a < b) {
      swap(a, b);
    }
    if (a == b)
      cout << "0" << endl;
    else {
      c = a - b;
      if (c == 2 || c == 1)
        cout << 1 << endl;
      else if (c == 3 || c == 4)
        cout << 2 << endl;
      else if (c % 5 == 0) {
        cout << c / 5 << endl;
      } else {
        d = c % 5;
        e = c / 5;
        if (d == 2 || d == 1 || d == 5) cout << e + 1 << endl;
        if (d == 3 || d == 4) cout << e + 2 << endl;
      }
    }
  }
}
