class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.s: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

n = A("n")
i = B("i")
m = C("m")
e = D("e")
j = E("j")
f = D("f")
a = E("a")

n.q = i
n.v = i
n.s = e
n.z = m
i.o = e
i.t = n
i.q = f
m.q = n
m.t = n
m.p = f
m.z = i
e.s = a
e.y = f
e.p = n
e.t = i
j.p = n
j.y = f
j.x = e
j.r = a
f.s = j
f.y = e
f.p = n
f.t = i
a.p = n
a.y = f
a.x = f
a.r = j
assert n.v.o.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.s: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

n = A("n")
i = B("i")
m = C("m")
e = D("e")
j = E("j")
f = D("f")
a = E("a")

n.q = i
n.v = i
n.s = e
n.z = m
i.o = e
i.t = n
i.q = f
m.q = n
m.t = n
m.p = f
m.z = i
e.s = a
e.y = f
e.p = n
e.t = i
j.p = n
j.y = f
j.x = e
j.r = a
f.s = j
f.y = e
f.p = n
f.t = i
a.p = n
a.y = f
a.x = f
a.r = j
assert n.v.o.y.t.txt == "i"