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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: B = None
        self.v: B = None
        self.s: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: B = None
        self.v: B = None
        self.s: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

m.x = a
a.u = d
a.r = l
a.v = l
a.s = f
a.o = e
d.o = m
d.v = a
e.z = i
e.r = i
e.u = n
e.o = d
e.p = d
k.x = d
k.q = d
k.y = f
k.z = e
l.u = d
l.r = a
l.v = a
l.s = f
l.o = e
i.x = d
i.q = d
i.y = e
i.z = e
n.x = l
f.z = k
f.r = k
f.u = m
f.o = d
f.p = d
assert f.p.v.u.o.x.u.o.txt == "m"