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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: F = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
g = C("g")
i = D("i")
k = E("k")
n = F("n")
f = G("f")
b = H("b")
e = D("e")

m.w = g
j.y = k
j.z = g
g.q = n
i.q = f
i.t = j
k.z = j
k.s = n
n.w = j
n.q = e
n.z = f
f.z = n
f.s = m
b.y = e
e.q = f
e.t = j
assert e.t.y.s.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: F = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
g = C("g")
i = D("i")
k = E("k")
n = F("n")
f = G("f")
b = H("b")
e = D("e")

m.w = g
j.y = k
j.z = g
g.q = n
i.q = f
i.t = j
k.z = j
k.s = n
n.w = j
n.q = e
n.z = f
f.z = n
f.s = m
b.y = e
e.q = f
e.t = j
assert e.t.y.s.w.y.txt == "k"