class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: D = None
        self.r: C = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: F = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: H = None
        self.w: E = None
        self.x: D = None
        self.s: H = None
        self.t: B = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.z: C = None
        self.t: A = None
        self.x: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.u: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: H = None
        self.s: H = None
        self.r: A = None
        self.y: A = None
        self.x: E = None
        self.w: E = None
        self.t: H = None
        self.u: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: E = None
        self.r: I = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: F = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: H = None
        self.w: E = None
        self.x: D = None
        self.s: H = None
        self.t: B = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.z: C = None
        self.t: A = None
        self.x: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.u: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: H = None
        self.s: H = None
        self.r: A = None
        self.y: A = None
        self.x: E = None
        self.w: E = None
        self.t: H = None
        self.u: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: E = None
        self.r: I = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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