class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: E = None
        self.p: F = None
        self.y: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.p: B = None
        self.o: G = None
        self.q: F = None
        self.s: G = None
        self.u: H = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

m.q = k
m.p = k
m.r = a
m.y = a
g.w = a
f.x = k
f.q = k
f.p = g
f.o = b
f.s = b
f.u = d
f.w = h
h.q = a
h.v = k
a.v = b
k.p = a
b.o = a
d.x = k
d.q = f
d.u = b
e.q = a
e.v = k
j.v = b
assert k.p.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: E = None
        self.p: F = None
        self.y: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.p: B = None
        self.o: G = None
        self.q: F = None
        self.s: G = None
        self.u: H = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

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