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.txt = txt

b = A("b")
j = B("j")
l = B("l")
c = B("c")

b.u = c
j.v = c
l.v = c
c.v = j
assert b.u.v.v.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.txt = txt

b = A("b")
j = B("j")
l = B("l")
c = B("c")

b.u = c
j.v = c
l.v = c
c.v = j
assert b.u.v.v.txt == "c"