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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.u: A = None
        self.v: C = None
        self.x: G = None
        self.y: D = None
        self.s: I = None
        self.r: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.z: E = None
        self.w: H = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.u: A = None
        self.v: C = None
        self.x: G = None
        self.y: D = None
        self.s: I = None
        self.r: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.z: E = None
        self.w: H = None
        self.txt = txt

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

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

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

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