class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: D = None
        self.q: A = None
        self.txt = txt

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

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

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

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

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

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

a.y = i
a.u = f
a.q = n
l.s = h
l.u = h
l.y = h
l.r = m
i.z = f
i.u = f
f.v = n
f.u = m
m.s = n
h.u = l
n.y = i
n.u = f
n.q = a
assert m.s.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: D = None
        self.q: A = None
        self.txt = txt

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

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

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

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

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

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

a.y = i
a.u = f
a.q = n
l.s = h
l.u = h
l.y = h
l.r = m
i.z = f
i.u = f
f.v = n
f.u = m
m.s = n
h.u = l
n.y = i
n.u = f
n.q = a
assert m.s.q.q.q.q.txt == "n"