class A:
    def __init__(self, txt: str):
        self.x: I = None
        self.z: E = None
        self.p: I = None
        self.r: E = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: G = None
        self.u: F = None
        self.q: E = None
        self.y: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.p: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: I = None
        self.w: C = None
        self.o: C = None
        self.s: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: G = None
        self.u: F = None
        self.q: I = None
        self.v: B = None
        self.y: I = None
        self.z: G = None
        self.x: D = None
        self.r: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: G = None
        self.u: F = None
        self.q: E = None
        self.y: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.p: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: I = None
        self.w: C = None
        self.o: C = None
        self.s: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: G = None
        self.u: F = None
        self.q: I = None
        self.v: B = None
        self.y: I = None
        self.z: G = None
        self.x: D = None
        self.r: E = None
        self.txt = txt

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

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

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