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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: B = None
        self.p: A = None
        self.q: F = None
        self.txt = txt

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

m = A("m")
i = B("i")
e = C("e")
b = D("b")
n = E("n")
a = F("a")
c = F("c")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: B = None
        self.p: A = None
        self.q: F = None
        self.txt = txt

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

m = A("m")
i = B("i")
e = C("e")
b = D("b")
n = E("n")
a = F("a")
c = F("c")

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