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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: E = None
        self.p: A = None
        self.w: E = None
        self.u: B = None
        self.txt = txt

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

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

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

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

d.t = k
k.y = h
k.q = a
k.w = a
k.p = d
k.u = e
l.q = k
h.o = g
h.t = d
g.p = k
g.y = e
g.z = a
e.y = h
e.q = f
e.p = d
e.w = g
e.u = k
i.q = k
f.p = e
f.y = e
f.z = a
a.p = k
a.y = e
a.z = f
assert k.u.q.z.p.y.t.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: E = None
        self.p: A = None
        self.w: E = None
        self.u: B = None
        self.txt = txt

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

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

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

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

d.t = k
k.y = h
k.q = a
k.w = a
k.p = d
k.u = e
l.q = k
h.o = g
h.t = d
g.p = k
g.y = e
g.z = a
e.y = h
e.q = f
e.p = d
e.w = g
e.u = k
i.q = k
f.p = e
f.y = e
f.z = a
a.p = k
a.y = e
a.z = f
assert k.u.q.z.p.y.t.t.p.txt == "d"