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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: E = None
        self.z: A = None
        self.u: B = None
        self.x: F = None
        self.s: B = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
n = C("n")
e = D("e")
g = E("g")
h = F("h")
i = A("i")
j = E("j")
m = E("m")

l.q = m
l.y = i
l.w = n
l.p = n
c.x = n
n.p = i
n.z = i
n.t = j
n.u = c
n.s = c
n.x = h
e.t = l
e.w = c
g.w = h
h.u = m
i.q = j
i.y = l
i.w = n
i.p = n
j.w = h
m.w = h
assert m.w.u.w.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: A = None
        self.w: C = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: E = None
        self.z: A = None
        self.u: B = None
        self.x: F = None
        self.s: B = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
n = C("n")
e = D("e")
g = E("g")
h = F("h")
i = A("i")
j = E("j")
m = E("m")

l.q = m
l.y = i
l.w = n
l.p = n
c.x = n
n.p = i
n.z = i
n.t = j
n.u = c
n.s = c
n.x = h
e.t = l
e.w = c
g.w = h
h.u = m
i.q = j
i.y = l
i.w = n
i.p = n
j.w = h
m.w = h
assert m.w.u.w.u.w.u.txt == "m"