class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.o: G = None
        self.y: C = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

g = A("g")
k = B("k")
a = C("a")
m = D("m")
b = E("b")
d = F("d")
f = G("f")
n = H("n")

g.r = n
g.o = f
g.y = a
g.s = b
k.w = n
a.t = g
m.q = a
m.o = n
b.u = g
b.x = g
b.t = g
b.p = d
b.o = k
b.v = k
b.q = n
b.w = a
d.p = k
d.x = b
f.w = b
n.w = m
assert b.q.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.o: G = None
        self.y: C = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

g = A("g")
k = B("k")
a = C("a")
m = D("m")
b = E("b")
d = F("d")
f = G("f")
n = H("n")

g.r = n
g.o = f
g.y = a
g.s = b
k.w = n
a.t = g
m.q = a
m.o = n
b.u = g
b.x = g
b.t = g
b.p = d
b.o = k
b.v = k
b.q = n
b.w = a
d.p = k
d.x = b
f.w = b
n.w = m
assert b.q.w.o.txt == "n"