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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: D = None
        self.q: D = None
        self.s: D = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: E = None
        self.x: A = None
        self.txt = txt

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

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

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

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

j.q = k
j.u = k
j.w = i
j.x = i
g.u = i
g.z = f
g.q = f
g.s = f
g.w = k
i.u = f
i.q = k
i.x = j
f.o = g
k.p = f
k.y = f
k.v = e
k.q = i
e.z = g
assert e.z.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: E = None
        self.w: C = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: D = None
        self.q: D = None
        self.s: D = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: E = None
        self.x: A = None
        self.txt = txt

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

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

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

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

j.q = k
j.u = k
j.w = i
j.x = i
g.u = i
g.z = f
g.q = f
g.s = f
g.w = k
i.u = f
i.q = k
i.x = j
f.o = g
k.p = f
k.y = f
k.v = e
k.q = i
e.z = g
assert e.z.z.o.txt == "g"