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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: C = None
        self.s: E = None
        self.o: E = None
        self.txt = txt

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

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

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

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

f.z = n
f.p = m
f.r = m
f.u = k
j.p = k
j.z = k
j.s = m
j.o = h
d.x = f
d.v = h
n.z = k
n.x = k
n.r = m
n.p = j
m.o = n
m.v = h
h.o = n
h.v = m
l.p = k
l.z = k
l.s = m
l.o = h
k.x = f
k.v = m
assert f.u.x.u.x.p.v.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: E = None
        self.r: E = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: C = None
        self.s: E = None
        self.o: E = None
        self.txt = txt

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

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

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

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

f.z = n
f.p = m
f.r = m
f.u = k
j.p = k
j.z = k
j.s = m
j.o = h
d.x = f
d.v = h
n.z = k
n.x = k
n.r = m
n.p = j
m.o = n
m.v = h
h.o = n
h.v = m
l.p = k
l.z = k
l.s = m
l.o = h
k.x = f
k.v = m
assert f.u.x.u.x.p.v.o.r.txt == "m"