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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

m = A("m")
e = B("e")
a = C("a")
h = D("h")
f = E("f")
c = F("c")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

m = A("m")
e = B("e")
a = C("a")
h = D("h")
f = E("f")
c = F("c")

m.w = f
m.t = h
m.o = a
e.p = m
e.z = h
e.t = c
e.q = f
e.o = f
a.v = c
a.t = e
h.s = a
f.w = e
f.t = m
f.y = c
c.t = e
assert c.t.z.s.t.txt == "e"