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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

l = A("l")
i = B("i")
f = C("f")
j = B("j")
b = B("b")

l.x = f
l.p = f
l.u = b
i.v = j
f.p = l
j.v = i
b.v = j
assert l.p.p.u.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: C = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

l = A("l")
i = B("i")
f = C("f")
j = B("j")
b = B("b")

l.x = f
l.p = f
l.u = b
i.v = j
f.p = l
j.v = i
b.v = j
assert l.p.p.u.v.v.txt == "i"