#include <bits/stdc++.h>
using namespace std;
const int a[5] = {0, 1, 1, 2, 2};
int t;
int main() {
  int x, y;
  scanf("%d", &t);
  while (t--)
    scanf("%d%d", &x, &y), printf("%d\n", abs(x - y) / 5 + a[abs(x - y) % 5]);
  return 0;
}
