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