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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: E = None
        self.v: D = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: E = None
        self.v: D = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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