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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

k = A("k")
g = B("g")
f = C("f")
a = D("a")
d = E("d")
m = F("m")

k.u = g
k.p = g
k.o = g
k.z = d
k.v = f
k.t = m
g.z = f
f.w = g
a.s = m
d.t = f
d.s = k
m.u = k
assert m.u.z.s.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: B = None
        self.z: E = None
        self.v: C = None
        self.t: F = None
        self.o: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

k = A("k")
g = B("g")
f = C("f")
a = D("a")
d = E("d")
m = F("m")

k.u = g
k.p = g
k.o = g
k.z = d
k.v = f
k.t = m
g.z = f
f.w = g
a.s = m
d.t = f
d.s = k
m.u = k
assert m.u.z.s.u.z.txt == "f"