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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: C = None
        self.txt = txt

i = A("i")
e = B("e")
b = C("b")
k = D("k")
n = E("n")
g = F("g")

i.x = e
e.w = k
e.q = g
b.q = e
b.s = e
b.u = k
b.x = g
b.p = g
b.z = n
k.s = b
k.t = g
n.y = e
g.w = e
g.y = b
assert g.y.z.y.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: C = None
        self.txt = txt

i = A("i")
e = B("e")
b = C("b")
k = D("k")
n = E("n")
g = F("g")

i.x = e
e.w = k
e.q = g
b.q = e
b.s = e
b.u = k
b.x = g
b.p = g
b.z = n
k.s = b
k.t = g
n.y = e
g.w = e
g.y = b
assert g.y.z.y.q.w.txt == "e"