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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

h.x = d
h.z = k
h.r = b
h.o = b
h.y = l
f.w = l
f.z = h
f.y = a
f.o = m
b.q = k
b.x = k
b.z = h
d.u = b
l.t = d
l.o = n
a.u = b
k.x = a
k.z = n
k.r = b
k.o = b
k.y = l
n.x = a
n.z = k
n.r = b
n.o = b
n.y = l
m.u = b
assert a.u.x.z.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: A = None
        self.r: C = None
        self.o: C = None
        self.y: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

h.x = d
h.z = k
h.r = b
h.o = b
h.y = l
f.w = l
f.z = h
f.y = a
f.o = m
b.q = k
b.x = k
b.z = h
d.u = b
l.t = d
l.o = n
a.u = b
k.x = a
k.z = n
k.r = b
k.o = b
k.y = l
n.x = a
n.z = k
n.r = b
n.o = b
n.y = l
m.u = b
assert a.u.x.z.x.u.txt == "b"