class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.txt = txt

i = A("i")
k = B("k")
l = A("l")
c = B("c")

i.u = k
k.v = c
k.s = c
l.u = k
c.v = k
c.s = k
assert k.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.txt = txt

i = A("i")
k = B("k")
l = A("l")
c = B("c")

i.u = k
k.v = c
k.s = c
l.u = k
c.v = k
c.s = k
assert k.s.v.s.txt == "c"