class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: D = None
        self.s: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: D = None
        self.p: A = None
        self.s: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

e = A("e")
j = B("j")
l = C("l")
g = D("g")
f = E("f")
k = F("k")

e.w = j
e.o = g
e.s = g
e.x = g
j.y = e
j.p = e
j.q = g
j.s = g
j.z = l
l.w = e
g.o = f
g.r = f
f.p = e
f.s = l
k.z = f
assert k.z.p.o.o.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: D = None
        self.s: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: D = None
        self.p: A = None
        self.s: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

e = A("e")
j = B("j")
l = C("l")
g = D("g")
f = E("f")
k = F("k")

e.w = j
e.o = g
e.s = g
e.x = g
j.y = e
j.p = e
j.q = g
j.s = g
j.z = l
l.w = e
g.o = f
g.r = f
f.p = e
f.s = l
k.z = f
assert k.z.p.o.o.p.w.txt == "j"