#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
int main() {
  int t, sum;
  scanf("%d", &t);
  while (t--) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x == y) {
      printf("0\n");
    } else {
      int z = abs(y - x);
      sum = z / 5;
      z = z % 5;
      if (z == 1 || z == 2)
        sum += 1;
      else if (z == 3 || z == 4)
        sum += 2;
      printf("%d\n", sum);
    }
  }
  return 0;
}
