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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.q: A = None
        self.txt = txt

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

a = A("a")
e = B("e")
f = C("f")
g = D("g")
d = E("d")
n = F("n")

a.u = d
a.w = d
e.s = n
e.z = f
e.v = a
f.x = a
f.t = d
g.u = a
g.o = d
d.v = e
d.r = f
d.q = a
n.p = a
n.w = a
n.r = d
n.x = e
assert g.u.u.q.w.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.q: A = None
        self.txt = txt

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

a = A("a")
e = B("e")
f = C("f")
g = D("g")
d = E("d")
n = F("n")

a.u = d
a.w = d
e.s = n
e.z = f
e.v = a
f.x = a
f.t = d
g.u = a
g.o = d
d.v = e
d.r = f
d.q = a
n.p = a
n.w = a
n.r = d
n.x = e
assert g.u.u.q.w.v.s.txt == "n"