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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.r: G = None
        self.v: I = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: D = None
        self.q: E = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: H = None
        self.o: B = None
        self.p: A = None
        self.u: A = None
        self.q: A = None
        self.z: I = None
        self.r: A = None
        self.t: C = None
        self.s: B = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

l.p = i
l.r = i
l.u = i
j.s = d
j.r = d
j.v = m
j.q = l
c.y = d
c.o = h
c.q = f
c.x = f
h.v = i
h.o = j
h.s = j
h.p = l
h.u = l
h.q = l
h.r = l
h.z = m
h.t = c
f.x = h
k.u = l
k.p = h
k.o = h
k.s = f
k.t = i
d.r = c
d.w = i
i.w = c
m.s = k
m.y = f
m.r = h
m.q = c
assert j.s.w.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.r: H = None
        self.u: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.r: G = None
        self.v: I = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: D = None
        self.q: E = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: H = None
        self.o: B = None
        self.p: A = None
        self.u: A = None
        self.q: A = None
        self.z: I = None
        self.r: A = None
        self.t: C = None
        self.s: B = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

l.p = i
l.r = i
l.u = i
j.s = d
j.r = d
j.v = m
j.q = l
c.y = d
c.o = h
c.q = f
c.x = f
h.v = i
h.o = j
h.s = j
h.p = l
h.u = l
h.q = l
h.r = l
h.z = m
h.t = c
f.x = h
k.u = l
k.p = h
k.o = h
k.s = f
k.t = i
d.r = c
d.w = i
i.w = c
m.s = k
m.y = f
m.r = h
m.q = c
assert j.s.w.w.y.txt == "d"