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

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

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

e = A("e")
l = B("l")
j = C("j")
g = C("g")
d = C("d")

e.v = l
e.z = l
l.x = e
j.y = d
g.y = d
d.y = j
assert l.x.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: B = None
        self.txt = txt

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

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

e = A("e")
l = B("l")
j = C("j")
g = C("g")
d = C("d")

e.v = l
e.z = l
l.x = e
j.y = d
g.y = d
d.y = j
assert l.x.v.x.txt == "e"