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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.x: A = None
        self.w: B = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: B = None
        self.w: A = None
        self.t: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: D = None
        self.y: E = None
        self.p: D = None
        self.q: E = None
        self.r: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.x: A = None
        self.w: B = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: B = None
        self.w: A = None
        self.t: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: D = None
        self.y: E = None
        self.p: D = None
        self.q: E = None
        self.r: D = None
        self.txt = txt

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

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