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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: G = None
        self.txt = txt

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

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: G = None
        self.txt = txt

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

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

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

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

g.o = a
g.w = b
i.w = g
i.t = b
i.r = k
b.o = e
m.v = a
m.p = a
m.t = k
a.v = m
a.o = f
e.v = a
e.p = g
e.w = k
e.r = b
e.u = b
e.z = b
e.q = i
e.x = m
f.p = i
f.s = e
k.u = m
assert b.o.z.o.z.o.q.r.txt == "k"