try this
SELECT account
FROM deposits AS d1
WHERE [debit/credit] IN ('debit', 'credit')
AND EXISTS (
SELECT 1
FROM deposits AS d2
WHERE d2.account = d1.account
AND d2.[debit/credit] <> d1.[debit/credit]
AND d2.time BETWEEN DateAdd("n", -3, d1.time) AND d1.time
)
GROUP BY account
HAVING COUNT(*) >= 3
AND SUM(IIF([debit/credit]='credit', amount, -amount)) >= 50000;