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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: C = None
        self.s: B = None
        self.p: C = None
        self.u: A = None
        self.txt = txt

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

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

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

h.q = d
h.z = d
h.p = g
g.s = f
a.r = i
a.s = i
a.q = b
a.p = b
a.u = h
k.q = f
k.o = d
k.y = d
d.y = g
i.s = f
b.r = g
b.q = a
b.p = a
b.s = i
b.u = h
f.q = d
f.z = d
f.p = i
assert h.z.y.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: E = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: C = None
        self.s: B = None
        self.p: C = None
        self.u: A = None
        self.txt = txt

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

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

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

h.q = d
h.z = d
h.p = g
g.s = f
a.r = i
a.s = i
a.q = b
a.p = b
a.u = h
k.q = f
k.o = d
k.y = d
d.y = g
i.s = f
b.r = g
b.q = a
b.p = a
b.s = i
b.u = h
f.q = d
f.z = d
f.p = i
assert h.z.y.s.z.txt == "d"