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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: D = None
        self.s: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: D = None
        self.u: D = None
        self.q: A = None
        self.txt = txt

h = A("h")
i = B("i")
a = C("a")
k = D("k")
e = E("e")
d = D("d")

h.x = a
h.q = a
i.w = h
i.q = h
i.s = k
i.z = a
i.t = a
a.o = i
k.y = i
k.s = i
k.u = d
e.s = d
e.r = k
e.u = k
e.q = h
d.y = i
d.s = i
d.u = k
assert d.u.u.u.s.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: D = None
        self.s: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: D = None
        self.u: D = None
        self.q: A = None
        self.txt = txt

h = A("h")
i = B("i")
a = C("a")
k = D("k")
e = E("e")
d = D("d")

h.x = a
h.q = a
i.w = h
i.q = h
i.s = k
i.z = a
i.t = a
a.o = i
k.y = i
k.s = i
k.u = d
e.s = d
e.r = k
e.u = k
e.q = h
d.y = i
d.s = i
d.u = k
assert d.u.u.u.s.q.q.txt == "a"