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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: D = None
        self.p: C = None
        self.q: E = None
        self.s: B = None
        self.txt = txt

d = A("d")
g = B("g")
m = C("m")
e = D("e")
f = E("f")
n = D("n")
i = D("i")
h = E("h")

d.t = h
d.z = f
d.p = g
d.v = m
g.r = d
g.v = m
g.u = m
m.y = i
m.p = g
m.z = e
m.q = d
m.u = n
e.o = m
f.v = g
f.s = g
f.y = e
f.p = m
f.q = h
n.o = m
i.o = m
h.v = g
h.s = g
h.y = e
h.p = m
h.q = f
assert m.y.o.u.o.q.v.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: E = None
        self.p: B = None
        self.v: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: D = None
        self.p: C = None
        self.q: E = None
        self.s: B = None
        self.txt = txt

d = A("d")
g = B("g")
m = C("m")
e = D("e")
f = E("f")
n = D("n")
i = D("i")
h = E("h")

d.t = h
d.z = f
d.p = g
d.v = m
g.r = d
g.v = m
g.u = m
m.y = i
m.p = g
m.z = e
m.q = d
m.u = n
e.o = m
f.v = g
f.s = g
f.y = e
f.p = m
f.q = h
n.o = m
i.o = m
h.v = g
h.s = g
h.y = e
h.p = m
h.q = f
assert m.y.o.u.o.q.v.p.r.txt == "d"