write longest pair length