class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: B = None
        self.x: F = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

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