Highly effective and selective molecular nanowire catalysts for hydrogen and ammonia synthesis