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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: B = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: B = None
        self.w: F = None
        self.txt = txt

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

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

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