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

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

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

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

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

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

a = A("a")
n = B("n")
h = C("h")
i = D("i")
e = E("e")
d = F("d")

a.v = n
a.w = n
a.q = h
a.u = h
a.x = d
n.x = e
h.p = n
h.q = n
h.r = n
i.u = e
i.s = h
i.t = a
e.z = i
e.o = a
e.u = d
e.q = n
e.s = h
d.z = h
assert a.v.x.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.q: C = None
        self.x: F = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

a = A("a")
n = B("n")
h = C("h")
i = D("i")
e = E("e")
d = F("d")

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