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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.u: D = None
        self.r: B = None
        self.y: E = None
        self.t: A = None
        self.txt = txt

f = A("f")
a = B("a")
m = C("m")
b = D("b")
l = E("l")
h = F("h")

f.v = a
f.r = b
f.y = m
a.s = f
a.o = b
m.z = h
m.w = h
m.r = b
m.s = f
b.p = l
b.z = l
b.q = m
l.w = m
l.y = b
h.o = a
h.r = a
h.s = b
h.u = b
h.y = l
h.t = f
assert m.z.y.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.u: D = None
        self.r: B = None
        self.y: E = None
        self.t: A = None
        self.txt = txt

f = A("f")
a = B("a")
m = C("m")
b = D("b")
l = E("l")
h = F("h")

f.v = a
f.r = b
f.y = m
a.s = f
a.o = b
m.z = h
m.w = h
m.r = b
m.s = f
b.p = l
b.z = l
b.q = m
l.w = m
l.y = b
h.o = a
h.r = a
h.s = b
h.u = b
h.y = l
h.t = f
assert m.z.y.w.s.txt == "f"