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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: A = None
        self.y: D = None
        self.z: C = None
        self.o: C = None
        self.txt = txt

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

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

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

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

a.x = d
a.t = d
a.z = k
a.p = k
g.q = b
g.r = b
g.y = d
g.z = n
g.o = n
n.o = k
n.y = i
n.t = b
d.z = n
d.s = n
d.u = n
d.y = n
d.w = n
k.y = b
b.x = d
b.t = d
b.z = k
b.p = k
i.q = a
i.r = b
i.y = d
i.z = n
i.o = n
assert b.t.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: E = None
        self.p: E = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: A = None
        self.y: D = None
        self.z: C = None
        self.o: C = None
        self.txt = txt

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

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

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

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

a.x = d
a.t = d
a.z = k
a.p = k
g.q = b
g.r = b
g.y = d
g.z = n
g.o = n
n.o = k
n.y = i
n.t = b
d.z = n
d.s = n
d.u = n
d.y = n
d.w = n
k.y = b
b.x = d
b.t = d
b.z = k
b.p = k
i.q = a
i.r = b
i.y = d
i.z = n
i.o = n
assert b.t.y.y.y.txt == "d"