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

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

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

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

e = A("e")
h = B("h")
d = C("d")
b = D("b")
l = A("l")
i = C("i")
k = D("k")
m = D("m")
n = B("n")
f = C("f")

e.u = b
e.p = h
h.o = n
h.p = n
h.z = b
d.p = b
d.t = k
d.v = l
d.z = l
b.o = m
b.x = h
b.z = n
b.r = k
l.u = b
l.p = h
i.p = m
i.t = k
i.v = e
i.z = e
k.o = m
k.x = n
k.z = n
k.r = b
m.o = k
m.r = k
m.x = n
m.z = h
n.o = h
n.p = h
n.z = m
f.p = b
f.t = k
f.v = e
f.z = e
assert i.p.x.o.z.r.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: B = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
d = C("d")
b = D("b")
l = A("l")
i = C("i")
k = D("k")
m = D("m")
n = B("n")
f = C("f")

e.u = b
e.p = h
h.o = n
h.p = n
h.z = b
d.p = b
d.t = k
d.v = l
d.z = l
b.o = m
b.x = h
b.z = n
b.r = k
l.u = b
l.p = h
i.p = m
i.t = k
i.v = e
i.z = e
k.o = m
k.x = n
k.z = n
k.r = b
m.o = k
m.r = k
m.x = n
m.z = h
n.o = h
n.p = h
n.z = m
f.p = b
f.t = k
f.v = e
f.z = e
assert i.p.x.o.z.r.r.o.txt == "m"