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

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

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

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

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

k = A("k")
h = B("h")
n = C("n")
j = D("j")
c = E("c")
d = C("d")
e = D("e")

k.r = d
h.r = e
h.u = c
n.z = k
n.s = c
n.o = e
n.r = h
j.v = n
j.y = e
j.w = h
c.u = n
c.t = k
d.z = k
d.s = c
d.o = e
d.r = h
e.v = d
e.y = j
e.w = h
assert c.u.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

k = A("k")
h = B("h")
n = C("n")
j = D("j")
c = E("c")
d = C("d")
e = D("e")

k.r = d
h.r = e
h.u = c
n.z = k
n.s = c
n.o = e
n.r = h
j.v = n
j.y = e
j.w = h
c.u = n
c.t = k
d.z = k
d.s = c
d.o = e
d.r = h
e.v = d
e.y = j
e.w = h
assert c.u.o.y.txt == "j"