class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: E = None
        self.x: C = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: F = None
        self.q: C = None
        self.t: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: E = None
        self.s: F = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: F = None
        self.q: C = None
        self.t: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: E = None
        self.s: F = None
        self.v: E = None
        self.txt = txt

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

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

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

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