class A:
    def __init__(self, txt: str):
        self.r: I = None
        self.y: F = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: D = None
        self.w: I = None
        self.v: H = None
        self.z: H = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: E = None
        self.q: G = None
        self.o: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.r: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: A = None
        self.v: D = None
        self.x: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: B = None
        self.u: D = None
        self.txt = txt

l = A("l")
h = B("h")
d = C("d")
k = D("k")
i = E("i")
g = F("g")
e = G("e")
a = H("a")
m = I("m")

l.r = m
l.y = g
l.t = g
h.t = k
h.s = k
h.p = k
h.w = m
h.v = a
h.z = a
d.z = i
d.t = i
d.q = e
d.o = l
k.r = a
k.w = e
i.u = l
g.p = i
g.r = h
e.p = g
e.r = l
a.q = h
a.y = l
a.x = l
a.v = k
m.r = k
m.u = k
m.t = h
assert g.r.t.w.r.r.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: I = None
        self.y: F = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: D = None
        self.w: I = None
        self.v: H = None
        self.z: H = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: E = None
        self.q: G = None
        self.o: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.r: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: A = None
        self.v: D = None
        self.x: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: B = None
        self.u: D = None
        self.txt = txt

l = A("l")
h = B("h")
d = C("d")
k = D("k")
i = E("i")
g = F("g")
e = G("e")
a = H("a")
m = I("m")

l.r = m
l.y = g
l.t = g
h.t = k
h.s = k
h.p = k
h.w = m
h.v = a
h.z = a
d.z = i
d.t = i
d.q = e
d.o = l
k.r = a
k.w = e
i.u = l
g.p = i
g.r = h
e.p = g
e.r = l
a.q = h
a.y = l
a.x = l
a.v = k
m.r = k
m.u = k
m.t = h
assert g.r.t.w.r.r.t.w.txt == "m"