class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: H = None
        self.r: F = None
        self.p: H = None
        self.z: A = None
        self.o: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: B = None
        self.o: H = None
        self.v: G = None
        self.z: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: H = None
        self.v: C = None
        self.u: C = None
        self.y: F = None
        self.z: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: E = None
        self.q: G = None
        self.x: E = None
        self.txt = txt

d = A("d")
j = B("j")
c = C("c")
m = D("m")
n = E("n")
f = F("f")
h = G("h")
a = H("a")
e = E("e")

d.y = c
j.o = m
c.x = m
m.r = n
m.w = n
n.q = a
n.p = a
n.r = f
n.z = d
n.o = j
f.y = d
f.u = j
f.o = a
f.v = h
f.z = c
h.s = a
h.v = c
h.u = c
h.y = f
h.z = j
a.u = n
a.y = n
a.x = n
a.q = h
e.q = a
e.p = a
e.r = f
e.z = d
e.o = j
assert m.w.z.y.x.w.q.q.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: H = None
        self.r: F = None
        self.p: H = None
        self.z: A = None
        self.o: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: B = None
        self.o: H = None
        self.v: G = None
        self.z: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: H = None
        self.v: C = None
        self.u: C = None
        self.y: F = None
        self.z: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: E = None
        self.q: G = None
        self.x: E = None
        self.txt = txt

d = A("d")
j = B("j")
c = C("c")
m = D("m")
n = E("n")
f = F("f")
h = G("h")
a = H("a")
e = E("e")

d.y = c
j.o = m
c.x = m
m.r = n
m.w = n
n.q = a
n.p = a
n.r = f
n.z = d
n.o = j
f.y = d
f.u = j
f.o = a
f.v = h
f.z = c
h.s = a
h.v = c
h.u = c
h.y = f
h.z = j
a.u = n
a.y = n
a.x = n
a.q = h
e.q = a
e.p = a
e.r = f
e.z = d
e.o = j
assert m.w.z.y.x.w.q.q.z.o.txt == "m"