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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: A = None
        self.w: B = None
        self.t: B = None
        self.txt = txt

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

n.u = m
n.p = m
n.t = d
n.r = i
d.t = m
d.u = m
c.z = m
a.q = b
a.s = d
a.z = m
m.q = d
b.x = a
b.s = i
b.w = d
b.t = d
i.u = m
i.p = m
i.t = d
i.r = n
h.q = b
h.s = d
h.z = m
e.q = b
e.s = d
e.z = m
f.q = b
f.s = d
f.z = m
assert d.u.q.t.q.t.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: B = None
        self.r: A = None
        self.p: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: A = None
        self.w: B = None
        self.t: B = None
        self.txt = txt

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

n.u = m
n.p = m
n.t = d
n.r = i
d.t = m
d.u = m
c.z = m
a.q = b
a.s = d
a.z = m
m.q = d
b.x = a
b.s = i
b.w = d
b.t = d
i.u = m
i.p = m
i.t = d
i.r = n
h.q = b
h.s = d
h.z = m
e.q = b
e.s = d
e.z = m
f.q = b
f.s = d
f.z = m
assert d.u.q.t.q.t.q.t.txt == "m"