class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: D = None
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: B = None
        self.x: B = None
        self.w: B = None
        self.p: C = None
        self.txt = txt

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

a.z = c
a.r = c
a.v = n
k.q = c
k.z = c
m.q = n
m.x = n
m.y = k
n.y = c
n.x = c
c.v = n
c.z = k
c.x = k
c.w = k
c.p = d
b.q = n
b.x = n
b.y = k
d.q = n
d.x = n
d.y = k
i.q = n
i.x = n
i.y = k
assert c.p.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: D = None
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: B = None
        self.x: B = None
        self.w: B = None
        self.p: C = None
        self.txt = txt

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

a.z = c
a.r = c
a.v = n
k.q = c
k.z = c
m.q = n
m.x = n
m.y = k
n.y = c
n.x = c
c.v = n
c.z = k
c.x = k
c.w = k
c.p = d
b.q = n
b.x = n
b.y = k
d.q = n
d.x = n
d.y = k
i.q = n
i.x = n
i.y = k
assert c.p.y.q.txt == "c"