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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: C = None
        self.p: A = None
        self.r: C = None
        self.txt = txt

n = A("n")
g = B("g")
c = C("c")
d = D("d")
b = E("b")
j = B("j")
k = D("k")
l = B("l")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: C = None
        self.p: A = None
        self.r: C = None
        self.txt = txt

n = A("n")
g = B("g")
c = C("c")
d = D("d")
b = E("b")
j = B("j")
k = D("k")
l = B("l")

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