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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

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

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

d = A("d")
n = B("n")
f = C("f")
l = D("l")
h = E("h")
b = F("b")

d.x = b
d.p = b
d.y = n
d.r = h
n.y = d
f.z = b
f.u = h
l.o = b
l.w = b
l.u = n
l.y = n
l.v = f
l.z = f
h.o = f
h.z = n
b.x = d
b.s = d
b.t = f
b.q = l
b.z = l
b.w = h
assert f.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: B = None
        self.p: F = None
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

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

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

d = A("d")
n = B("n")
f = C("f")
l = D("l")
h = E("h")
b = F("b")

d.x = b
d.p = b
d.y = n
d.r = h
n.y = d
f.z = b
f.u = h
l.o = b
l.w = b
l.u = n
l.y = n
l.v = f
l.z = f
h.o = f
h.z = n
b.x = d
b.s = d
b.t = f
b.q = l
b.z = l
b.w = h
assert f.z.w.z.txt == "n"