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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: E = None
        self.r: A = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: E = None
        self.r: A = None
        self.txt = txt

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

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

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

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

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

e.z = b
e.p = g
e.x = g
g.u = l
g.s = f
g.r = e
j.x = b
j.y = g
j.q = e
l.o = j
l.t = e
l.w = e
f.p = b
f.v = l
f.z = e
f.q = j
b.w = g
b.o = g
b.u = g
b.q = f
b.y = j
b.s = j
assert g.s.p.s.q.z.q.txt == "f"