Northern Ireland agreement could end deadlock, restore government