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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.v: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: D = None
        self.s: A = None
        self.z: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.v: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: D = None
        self.s: A = None
        self.z: D = None
        self.txt = txt

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

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

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

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