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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: F = None
        self.s: F = None
        self.x: E = None
        self.q: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: C = None
        self.y: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

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

m.o = b
m.v = b
b.y = f
b.o = d
b.s = d
b.q = d
b.x = n
f.z = l
l.s = b
l.y = b
l.o = f
n.o = m
n.p = l
d.y = b
d.q = b
d.s = n
assert b.y.z.o.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: F = None
        self.s: F = None
        self.x: E = None
        self.q: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: C = None
        self.y: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.s: E = None
        self.txt = txt

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

m.o = b
m.v = b
b.y = f
b.o = d
b.s = d
b.q = d
b.x = n
f.z = l
l.s = b
l.y = b
l.o = f
n.o = m
n.p = l
d.y = b
d.q = b
d.s = n
assert b.y.z.o.z.o.txt == "f"