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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: B = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: E = None
        self.s: F = None
        self.u: B = None
        self.p: G = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: B = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: E = None
        self.s: F = None
        self.u: B = None
        self.p: G = None
        self.z: B = None
        self.txt = txt

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

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

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

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

k.q = f
e.p = f
f.s = e
f.o = e
f.w = b
b.r = f
b.y = n
b.s = h
b.u = e
b.z = e
b.p = d
n.q = f
n.r = h
n.x = h
n.v = b
h.z = e
d.w = f
d.v = f
assert n.q.s.p.w.s.txt == "h"