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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.u: A = None
        self.t: D = None
        self.z: A = None
        self.x: B = None
        self.txt = txt

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

n = A("n")
d = B("d")
m = C("m")
f = D("f")
k = E("k")
l = F("l")

n.y = k
n.q = d
n.z = d
n.x = l
d.o = m
m.r = l
f.x = m
f.y = l
f.w = k
k.o = n
k.w = n
k.u = n
k.z = n
k.t = f
k.x = d
l.u = k
l.y = n
assert l.u.t.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: B = None
        self.x: F = None
        self.z: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.u: A = None
        self.t: D = None
        self.z: A = None
        self.x: B = None
        self.txt = txt

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

n = A("n")
d = B("d")
m = C("m")
f = D("f")
k = E("k")
l = F("l")

n.y = k
n.q = d
n.z = d
n.x = l
d.o = m
m.r = l
f.x = m
f.y = l
f.w = k
k.o = n
k.w = n
k.u = n
k.z = n
k.t = f
k.x = d
l.u = k
l.y = n
assert l.u.t.w.x.txt == "d"