class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.w: G = None
        self.u: B = None
        self.y: I = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: J = None
        self.r: E = None
        self.p: I = None
        self.w: J = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: J = None
        self.q: F = None
        self.t: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: J = None
        self.u: A = None
        self.t: G = None
        self.r: I = None
        self.v: B = None
        self.w: C = None
        self.o: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: F = None
        self.w: I = None
        self.s: F = None
        self.x: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: C = None
        self.o: D = None
        self.y: H = None
        self.x: B = None
        self.txt = txt

h = A("h")
i = B("i")
l = C("l")
e = D("e")
d = E("d")
c = F("c")
j = G("j")
b = H("b")
n = I("n")
m = J("m")

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

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: J = None
        self.r: E = None
        self.p: I = None
        self.w: J = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: J = None
        self.q: F = None
        self.t: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: J = None
        self.u: A = None
        self.t: G = None
        self.r: I = None
        self.v: B = None
        self.w: C = None
        self.o: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: F = None
        self.w: I = None
        self.s: F = None
        self.x: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: C = None
        self.o: D = None
        self.y: H = None
        self.x: B = None
        self.txt = txt

h = A("h")
i = B("i")
l = C("l")
e = D("e")
d = E("d")
c = F("c")
j = G("j")
b = H("b")
n = I("n")
m = J("m")

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