class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.p: B = None
        self.r: E = None
        self.q: B = None
        self.z: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: E = None
        self.z: F = None
        self.x: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: E = None
        self.z: F = None
        self.x: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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