#include <bits/stdc++.h>
using namespace std;
int ans(int *a, int *b, int am) {
  int diff = abs(*a - *b);
  int g = diff / am;
  int h = 1;
  if (*a > *b) h = -1;
  int button = g;
  int n = *a + h * (g)*am;
  int m = *a + h * (g + 1) * am;
  if (abs(n - *b) > abs(m - *b) && (m >= 0)) {
    button++;
    *a = m;
  } else {
    *a = n;
  }
  return button;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int button = 0;
    int arr[3] = {5, 2, 1};
    for (int i = 0; i < 3; i++) {
      button += ans(&a, &b, arr[i]);
    }
    cout << button << endl;
  }
  return 0;
}
