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

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

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

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

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

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

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

n.q = b
a.p = d
a.t = d
a.r = b
h.v = b
h.u = d
m.u = a
m.z = h
b.u = d
d.o = b
d.u = b
d.p = b
d.r = a
d.v = a
d.z = n
assert n.q.u.u.u.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

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

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

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

n.q = b
a.p = d
a.t = d
a.r = b
h.v = b
h.u = d
m.u = a
m.z = h
b.u = d
d.o = b
d.u = b
d.p = b
d.r = a
d.v = a
d.z = n
assert n.q.u.u.u.z.q.txt == "b"