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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: C = None
        self.w: E = None
        self.t: A = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: C = None
        self.w: E = None
        self.t: A = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

g.x = b
g.p = c
g.z = c
b.z = f
b.r = f
b.y = c
b.w = k
b.t = g
c.z = k
c.v = f
n.z = f
n.p = c
k.w = e
f.q = c
f.s = c
f.t = n
f.r = b
e.z = f
e.p = c
assert b.w.w.z.q.z.w.txt == "e"