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