class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.w: D = None
        self.o: D = None
        self.p: B = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: D = None
        self.r: C = None
        self.txt = txt

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

k = A("k")
a = B("a")
n = C("n")
m = D("m")
e = E("e")
j = F("j")
l = D("l")

k.x = e
k.w = m
k.o = m
k.p = a
k.q = a
k.y = n
a.x = n
a.w = n
a.z = l
n.x = a
m.y = j
m.t = e
e.q = n
e.r = n
e.p = m
j.z = a
l.y = j
l.t = e
assert m.t.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.w: D = None
        self.o: D = None
        self.p: B = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: D = None
        self.r: C = None
        self.txt = txt

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

k = A("k")
a = B("a")
n = C("n")
m = D("m")
e = E("e")
j = F("j")
l = D("l")

k.x = e
k.w = m
k.o = m
k.p = a
k.q = a
k.y = n
a.x = n
a.w = n
a.z = l
n.x = a
m.y = j
m.t = e
e.q = n
e.r = n
e.p = m
j.z = a
l.y = j
l.t = e
assert m.t.q.x.txt == "a"