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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: D = None
        self.t: F = None
        self.s: C = None
        self.z: C = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: A = None
        self.w: F = None
        self.x: E = None
        self.o: H = None
        self.s: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.x: H = None
        self.r: A = None
        self.o: H = None
        self.s: C = None
        self.u: D = None
        self.q: B = None
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: A = None
        self.v: C = None
        self.q: E = None
        self.o: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: D = None
        self.t: F = None
        self.s: C = None
        self.z: C = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: A = None
        self.w: F = None
        self.x: E = None
        self.o: H = None
        self.s: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.x: H = None
        self.r: A = None
        self.o: H = None
        self.s: C = None
        self.u: D = None
        self.q: B = None
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: A = None
        self.v: C = None
        self.q: E = None
        self.o: G = None
        self.txt = txt

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

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