class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: F = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

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

a.z = f
a.x = f
a.w = e
n.r = a
n.q = a
n.y = a
n.x = a
k.z = c
f.z = n
g.u = c
g.z = a
g.s = a
g.v = e
e.v = c
e.s = g
e.z = f
e.w = a
c.z = k
assert n.r.w.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: F = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

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

a.z = f
a.x = f
a.w = e
n.r = a
n.q = a
n.y = a
n.x = a
k.z = c
f.z = n
g.u = c
g.z = a
g.s = a
g.v = e
e.v = c
e.s = g
e.z = f
e.w = a
c.z = k
assert n.r.w.v.z.txt == "k"