class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: C = None
        self.y: E = None
        self.w: E = None
        self.v: E = None
        self.q: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.q: H = None
        self.y: G = None
        self.w: H = None
        self.t: B = None
        self.p: A = None
        self.z: H = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: A = None
        self.t: G = None
        self.x: A = None
        self.p: G = None
        self.v: A = None
        self.r: C = None
        self.o: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

g = A("g")
c = B("c")
k = C("k")
b = D("b")
d = E("d")
i = F("i")
e = G("e")
m = H("m")

g.t = d
g.y = d
g.w = d
g.v = d
g.s = k
g.q = m
c.q = b
c.p = e
c.x = e
c.o = d
c.t = g
c.v = g
k.x = e
k.y = e
k.q = m
k.w = m
k.z = m
k.t = c
k.p = g
b.q = d
b.t = i
b.y = i
b.x = i
d.r = b
d.p = c
i.w = m
i.q = g
i.x = g
i.v = g
i.o = g
i.t = e
i.p = e
i.r = k
e.t = i
e.o = k
m.p = e
assert k.p.y.r.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: C = None
        self.y: E = None
        self.w: E = None
        self.v: E = None
        self.q: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.q: H = None
        self.y: G = None
        self.w: H = None
        self.t: B = None
        self.p: A = None
        self.z: H = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: A = None
        self.t: G = None
        self.x: A = None
        self.p: G = None
        self.v: A = None
        self.r: C = None
        self.o: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

g = A("g")
c = B("c")
k = C("k")
b = D("b")
d = E("d")
i = F("i")
e = G("e")
m = H("m")

g.t = d
g.y = d
g.w = d
g.v = d
g.s = k
g.q = m
c.q = b
c.p = e
c.x = e
c.o = d
c.t = g
c.v = g
k.x = e
k.y = e
k.q = m
k.w = m
k.z = m
k.t = c
k.p = g
b.q = d
b.t = i
b.y = i
b.x = i
d.r = b
d.p = c
i.w = m
i.q = g
i.x = g
i.v = g
i.o = g
i.t = e
i.p = e
i.r = k
e.t = i
e.o = k
m.p = e
assert k.p.y.r.q.r.txt == "b"