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

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

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

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

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

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

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

j.q = i
j.x = d
n.x = e
n.w = d
n.u = d
d.z = g
d.w = n
d.s = i
g.z = l
g.q = d
l.p = d
l.q = j
l.y = e
l.s = n
i.q = l
i.o = l
e.q = i
e.x = d
assert e.q.o.s.w.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

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

j.q = i
j.x = d
n.x = e
n.w = d
n.u = d
d.z = g
d.w = n
d.s = i
g.z = l
g.q = d
l.p = d
l.q = j
l.y = e
l.s = n
i.q = l
i.o = l
e.q = i
e.x = d
assert e.q.o.s.w.z.z.txt == "l"