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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: B = None
        self.q: B = None
        self.v: C = None
        self.r: A = None
        self.x: A = None
        self.txt = txt

a = A("a")
c = B("c")
k = C("k")
d = D("d")
i = E("i")
f = F("f")

a.w = i
a.u = f
a.o = f
a.p = k
a.q = k
a.r = d
c.w = k
c.u = k
k.z = a
d.q = f
i.w = f
i.s = f
i.x = d
i.u = k
i.t = a
f.p = a
f.r = a
f.x = a
f.s = c
f.q = c
f.v = k
assert a.p.z.q.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: F = None
        self.p: C = None
        self.o: F = None
        self.r: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: B = None
        self.q: B = None
        self.v: C = None
        self.r: A = None
        self.x: A = None
        self.txt = txt

a = A("a")
c = B("c")
k = C("k")
d = D("d")
i = E("i")
f = F("f")

a.w = i
a.u = f
a.o = f
a.p = k
a.q = k
a.r = d
c.w = k
c.u = k
k.z = a
d.q = f
i.w = f
i.s = f
i.x = d
i.u = k
i.t = a
f.p = a
f.r = a
f.x = a
f.s = c
f.q = c
f.v = k
assert a.p.z.q.z.p.txt == "k"