ורבה אמר: יהנ״ק. ולוי אמר: קני״ה. ורבנן אמרי: קינ״ה. מר בריה דרבנא אמר: נקי״ה. מרתא אמר משמיה דרבי יהושע: ניה״ק.
And Rabba said that the correct order is yod, heh, nun, kuf: Wine [yayin], havdala, candle [ner], and kiddush. And Levi said the order is kuf, nun, yod, heh: Kiddush, candle [ner], wine [yayin], and havdala. And the Rabbis say the order is kuf, yod, nun, heh: kiddush, wine [yayin], candle [ner], and havdala. Mar, son of Rabbana, said the order is nun, kuf, yod, heh: Candle [ner], kiddush, wine [yayin], and havdala. The Sage named Marta said in the name of R' Yehoshua that the proper order is nun, yod, heh, kuf: Candle [ner], wine [yayin], havdala, and kiddush.
שלח ליה אבוה דשמואל לרבי: ילמדנו רבינו, סדר הבדלות היאך. שלח ליה: כך אמר רבי ישמעאל בר רבי יוסי שאמר משום אביו שאמר משום רבי יהושע בן חנניה: נהי״ק.
With regard to this issue, the father of Shmuel, Abba ben Abba, sent a letter to R' Yehuda HaNasi: Teach us, our R'. How should one recite the order of havdala when a Festival occurs after Shabbat? R' sent him the following response: This is what R' Yishmael, son of R' Yosei, said, who said it in the name of his father, who himself said it in the name of R' Yehoshua ben Ḥananya: The proper order of the blessings is nun, heh, yod, kuf: Candle [ner], havdala, wine [yayin], and kiddush.
אמר רבי חנינא: משל דרבי יהושע בן חנניה למלך שיוצא ואפרכוס נכנס, מלווין את המלך ואחר כך יוצאים לקראת אפרכוס.
R' Ḥanina said that the following parable serves to explain the opinion of R' Yehoshua ben Ḥananya: This is comparable to a king who is exiting a city and a governor is entering. Etiquette dictates that the inhabitants of the city first escort the king out of the city to take leave of him in a dignified fashion, and afterward they go out to greet the governor. Similarly, one should first recite havdala, to take leave of Shabbat, and only then recite kiddush over the Festival, whose sanctity is lesser than that of Shabbat.