The chaining lemma and its application