class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: E = None
        self.p: E = None
        self.r: A = None
        self.t: C = None
        self.o: E = None
        self.txt = txt

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

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

m.p = h
m.r = b
i.w = m
b.w = e
b.r = e
b.z = e
b.q = m
h.x = i
k.w = i
e.w = m
e.r = m
e.s = k
e.p = k
e.o = k
e.t = b
n.x = f
n.p = f
n.w = b
n.z = e
n.q = h
n.y = i
f.x = n
f.p = n
f.w = b
f.z = e
f.q = h
f.y = i
assert h.x.w.p.x.w.r.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: E = None
        self.p: E = None
        self.r: A = None
        self.t: C = None
        self.o: E = None
        self.txt = txt

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

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

m.p = h
m.r = b
i.w = m
b.w = e
b.r = e
b.z = e
b.q = m
h.x = i
k.w = i
e.w = m
e.r = m
e.s = k
e.p = k
e.o = k
e.t = b
n.x = f
n.p = f
n.w = b
n.z = e
n.q = h
n.y = i
f.x = n
f.p = n
f.w = b
f.z = e
f.q = h
f.y = i
assert h.x.w.p.x.w.r.w.o.txt == "k"