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

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

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

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

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

f = A("f")
a = B("a")
c = C("c")
e = D("e")
h = E("h")
i = C("i")
g = E("g")
n = A("n")

f.q = i
f.z = n
a.t = g
a.p = n
c.u = a
c.x = a
c.y = h
c.s = f
e.o = n
e.z = n
e.y = h
e.s = i
h.o = n
h.t = f
h.y = a
h.w = e
i.u = a
i.x = a
i.y = g
i.s = n
g.o = f
g.t = f
g.y = a
g.w = e
n.q = c
n.z = f
assert g.w.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: A = None
        self.txt = txt

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

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

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

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

f = A("f")
a = B("a")
c = C("c")
e = D("e")
h = E("h")
i = C("i")
g = E("g")
n = A("n")

f.q = i
f.z = n
a.t = g
a.p = n
c.u = a
c.x = a
c.y = h
c.s = f
e.o = n
e.z = n
e.y = h
e.s = i
h.o = n
h.t = f
h.y = a
h.w = e
i.u = a
i.x = a
i.y = g
i.s = n
g.o = f
g.t = f
g.y = a
g.w = e
n.q = c
n.z = f
assert g.w.z.q.txt == "c"