#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<int> steps{-5, -2, -1, 1, 2, 5};
  for (int i = 0; i < n; i++) {
    int count = 0;
    int a, b;
    std::cin >> a;
    std::cin >> b;
    if (a > b) {
      int t = a;
      a = b;
      b = t;
    }
    b -= a;
    a = 0;
    count += b / 5;
    b -= 5 * count;
    if (b % 5 == 1 || b % 5 == 2) {
      count++;
    } else if (b % 5 == 3 || b % 5 == 4) {
      count += 2;
    }
    std::cout << count << " ";
  }
  return 0;
}
