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

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

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

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

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

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

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

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

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

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

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

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

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