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

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

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

d = A("d")
e = B("e")
j = C("j")
c = C("c")
i = B("i")
k = C("k")
h = A("h")

d.t = h
d.w = i
d.z = e
e.o = i
e.x = c
j.w = e
c.w = i
i.o = e
i.x = j
k.w = e
h.t = d
h.w = e
h.z = e
assert e.x.w.x.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: B = None
        self.z: B = None
        self.txt = txt

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

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

d = A("d")
e = B("e")
j = C("j")
c = C("c")
i = B("i")
k = C("k")
h = A("h")

d.t = h
d.w = i
d.z = e
e.o = i
e.x = c
j.w = e
c.w = i
i.o = e
i.x = j
k.w = e
h.t = d
h.w = e
h.z = e
assert e.x.w.x.w.o.txt == "i"