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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.z: H = None
        self.w: A = None
        self.v: H = None
        self.y: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: J = None
        self.r: A = None
        self.u: D = None
        self.t: C = None
        self.v: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.v: J = None
        self.t: H = None
        self.w: C = None
        self.x: G = None
        self.z: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.z: H = None
        self.w: A = None
        self.v: H = None
        self.y: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: J = None
        self.r: A = None
        self.u: D = None
        self.t: C = None
        self.v: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.v: J = None
        self.t: H = None
        self.w: C = None
        self.x: G = None
        self.z: F = None
        self.txt = txt

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

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

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