import math, sequtils, strutils let t = parseInt readLine stdin nms = t.newSeqWith stdin.readLine.split.map parseInt var ans = "" for nm in nms: let n = nm[0] m = nm[1] sum = n + m v1 = n.ceilDiv 4 v2 = sum.ceilDiv 8 ans.addInt max(v1, v2) ans.add "\n" stdout.write ans