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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: D = None
        self.o: E = None
        self.p: D = None
        self.txt = txt

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

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

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

c = A("c")
n = B("n")
b = C("b")
e = D("e")
d = E("d")
m = D("m")
i = C("i")
j = A("j")

c.r = b
c.x = i
c.p = i
n.v = j
n.y = m
n.o = d
n.p = e
b.z = d
b.u = i
b.w = c
b.q = j
e.w = n
e.z = j
e.t = j
d.v = j
d.p = i
d.u = i
d.s = n
d.r = n
m.w = n
m.z = c
m.t = j
i.z = d
i.u = b
i.w = c
i.q = c
j.r = i
j.x = i
j.p = i
assert n.p.z.p.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: C = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: D = None
        self.o: E = None
        self.p: D = None
        self.txt = txt

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

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

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

c = A("c")
n = B("n")
b = C("b")
e = D("e")
d = E("d")
m = D("m")
i = C("i")
j = A("j")

c.r = b
c.x = i
c.p = i
n.v = j
n.y = m
n.o = d
n.p = e
b.z = d
b.u = i
b.w = c
b.q = j
e.w = n
e.z = j
e.t = j
d.v = j
d.p = i
d.u = i
d.s = n
d.r = n
m.w = n
m.z = c
m.t = j
i.z = d
i.u = b
i.w = c
i.q = c
j.r = i
j.x = i
j.p = i
assert n.p.z.p.q.r.txt == "b"