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

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

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

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

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

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

c = A("c")
d = B("d")
n = C("n")
a = D("a")
l = E("l")
m = F("m")

c.z = l
d.t = a
n.o = l
n.u = l
n.q = m
n.s = m
a.z = m
l.z = n
m.y = n
m.p = c
assert m.y.o.z.q.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

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

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

c = A("c")
d = B("d")
n = C("n")
a = D("a")
l = E("l")
m = F("m")

c.z = l
d.t = a
n.o = l
n.u = l
n.q = m
n.s = m
a.z = m
l.z = n
m.y = n
m.p = c
assert m.y.o.z.q.p.z.txt == "l"