class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: C = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: C = None
        self.u: F = None
        self.txt = txt

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

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

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

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