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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: D = None
        self.w: E = None
        self.v: E = None
        self.q: C = None
        self.txt = txt

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

k = A("k")
j = B("j")
h = C("h")
n = D("n")
e = E("e")
l = A("l")
f = D("f")

k.z = n
k.w = h
j.w = e
j.y = e
j.p = e
j.s = l
j.x = f
h.x = e
n.y = l
n.t = f
n.w = e
n.v = e
n.q = h
e.r = j
e.x = j
e.s = n
e.q = n
e.z = f
l.z = f
l.w = h
f.y = l
f.t = n
f.w = e
f.v = e
f.q = h
assert f.q.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: D = None
        self.w: E = None
        self.v: E = None
        self.q: C = None
        self.txt = txt

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

k = A("k")
j = B("j")
h = C("h")
n = D("n")
e = E("e")
l = A("l")
f = D("f")

k.z = n
k.w = h
j.w = e
j.y = e
j.p = e
j.s = l
j.x = f
h.x = e
n.y = l
n.t = f
n.w = e
n.v = e
n.q = h
e.r = j
e.x = j
e.s = n
e.q = n
e.z = f
l.z = f
l.w = h
f.y = l
f.t = n
f.w = e
f.v = e
f.q = h
assert f.q.x.s.txt == "n"