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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: E = None
        self.y: A = None
        self.txt = txt

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

d.q = k
d.p = m
i.x = k
i.y = k
i.z = k
i.v = n
f.s = i
f.y = i
f.p = n
f.v = d
m.s = k
m.w = d
m.v = f
n.y = m
n.x = f
n.q = k
n.t = d
k.v = n
k.o = n
k.y = d
assert d.p.s.y.p.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: E = None
        self.y: A = None
        self.txt = txt

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

d.q = k
d.p = m
i.x = k
i.y = k
i.z = k
i.v = n
f.s = i
f.y = i
f.p = n
f.v = d
m.s = k
m.w = d
m.v = f
n.y = m
n.x = f
n.q = k
n.t = d
k.v = n
k.o = n
k.y = d
assert d.p.s.y.p.s.y.txt == "d"