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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: E = None
        self.y: E = None
        self.z: E = None
        self.o: A = None
        self.txt = txt

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

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

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

a = A("a")
i = B("i")
j = C("j")
d = D("d")
f = E("f")
h = C("h")
b = B("b")
n = E("n")

a.x = n
i.r = d
i.t = f
i.y = f
i.z = f
i.o = a
j.v = a
j.z = a
j.p = a
j.u = b
j.s = d
d.r = f
d.t = b
d.z = a
f.r = b
h.v = a
h.z = a
h.p = a
h.u = b
h.s = d
b.r = d
b.t = f
b.z = f
b.y = n
b.o = a
n.r = i
assert i.z.r.z.r.r.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: E = None
        self.y: E = None
        self.z: E = None
        self.o: A = None
        self.txt = txt

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

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

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

a = A("a")
i = B("i")
j = C("j")
d = D("d")
f = E("f")
h = C("h")
b = B("b")
n = E("n")

a.x = n
i.r = d
i.t = f
i.y = f
i.z = f
i.o = a
j.v = a
j.z = a
j.p = a
j.u = b
j.s = d
d.r = f
d.t = b
d.z = a
f.r = b
h.v = a
h.z = a
h.p = a
h.u = b
h.s = d
b.r = d
b.t = f
b.z = f
b.y = n
b.o = a
n.r = i
assert i.z.r.z.r.r.z.x.txt == "n"