#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<int> v(6, 0);
  v[0] = -5;
  v[1] = -2;
  v[2] = -1;
  v[3] = 1;
  v[4] = 2;
  v[5] = 5;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int diff = b - a, ans;
    diff = abs(b - a);
    if (b - a == 0) {
      cout << 0 << endl;
    } else {
      ans = 0;
      for (int i = 5; i >= 0; i--) {
        if (diff >= v[i] && diff % v[i] == 0) {
          ans = ans + (diff / v[i]);
          break;
        } else if (diff >= v[i]) {
          if (v[i] == 5) {
            if (diff % 5 == 1 || diff % 5 == 2) {
              ans = ans + 1 + (diff / v[i]);
            } else {
              ans = ans + 2 + (diff / v[i]);
            }
          } else {
            ans = ans + 1 + (diff / v[i]);
          }
          break;
        }
      }
      cout << ans << endl;
    }
  }
}
