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

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

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

g = A("g")
i = B("i")
n = C("n")
d = A("d")
j = A("j")
c = C("c")
e = B("e")
l = C("l")
f = C("f")
b = A("b")

g.w = i
i.z = d
n.o = e
n.y = l
d.w = i
j.w = e
c.o = e
c.y = l
e.z = b
l.o = i
l.y = c
f.o = i
f.y = l
b.w = i
assert d.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

g = A("g")
i = B("i")
n = C("n")
d = A("d")
j = A("j")
c = C("c")
e = B("e")
l = C("l")
f = C("f")
b = A("b")

g.w = i
i.z = d
n.o = e
n.y = l
d.w = i
j.w = e
c.o = e
c.y = l
e.z = b
l.o = i
l.y = c
f.o = i
f.y = l
b.w = i
assert d.w.z.w.txt == "i"