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

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

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

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

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

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

c.x = n
c.z = d
n.v = d
n.o = c
n.t = k
h.s = j
h.r = i
j.s = n
j.y = n
j.q = d
d.x = k
k.s = i
k.r = j
i.s = n
i.y = n
i.q = d
l.x = n
l.z = d
assert d.x.r.s.o.z.x.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

c.x = n
c.z = d
n.v = d
n.o = c
n.t = k
h.s = j
h.r = i
j.s = n
j.y = n
j.q = d
d.x = k
k.s = i
k.r = j
i.s = n
i.y = n
i.q = d
l.x = n
l.z = d
assert d.x.r.s.o.z.x.r.y.txt == "n"