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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

m.v = b
m.z = f
i.x = d
i.y = c
f.x = m
c.s = b
d.p = i
b.o = i
b.r = d
n.s = b
a.v = b
a.z = f
assert a.v.o.y.s.r.p.y.txt == "c"