<prompt> Unapewa safu ya n jozi jozi ambapo jozii lefti, righti na lefti 3,4.Mfano wa 2:Ingizo: jozi 1,2,7,8,4,5Pato: 3Maelezo: Msururu mrefu zaidi ni 1,2 - 4,5 - 7,8.Vikwazo: n jozi.urefu 1 n 1000 -1000 lefti righti 1000  <response>: def findLongestChainjozi: pairs.pangaufunguolambda x: x1 urefu_wa_mnyororo 0 mwisho_kulia kuelea-inf kwa jozi katika jozi: ikiwa jozi0 last_right: mwisho_kulia jozi1 urefu_wa_mnyororo 1 rudisha max_chain_length 