class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

d = A("d")
f = B("f")
g = C("g")
h = D("h")
i = E("i")
e = C("e")
b = A("b")

d.w = h
d.z = h
d.o = i
f.o = h
g.z = d
g.u = f
g.p = i
h.t = i
i.q = g
e.z = d
e.u = f
e.p = i
b.w = h
b.z = h
b.o = i
assert f.o.t.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

d = A("d")
f = B("f")
g = C("g")
h = D("h")
i = E("i")
e = C("e")
b = A("b")

d.w = h
d.z = h
d.o = i
f.o = h
g.z = d
g.u = f
g.p = i
h.t = i
i.q = g
e.z = d
e.u = f
e.p = i
b.w = h
b.z = h
b.o = i
assert f.o.t.q.z.txt == "d"