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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.u: A = None
        self.y: F = None
        self.z: D = None
        self.q: A = None
        self.txt = txt

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

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

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

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

a = A("a")
m = B("m")
k = C("k")
g = D("g")
l = E("l")
n = F("n")
e = C("e")
b = E("b")
i = D("i")

a.p = n
m.s = n
m.y = n
m.u = a
m.q = a
m.z = i
k.s = i
k.z = g
k.u = e
k.p = e
g.p = m
l.x = b
l.r = a
n.u = e
n.w = l
n.p = a
e.s = i
e.z = i
e.u = k
e.p = k
b.x = l
b.r = a
i.p = m
assert i.p.z.p.u.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.u: A = None
        self.y: F = None
        self.z: D = None
        self.q: A = None
        self.txt = txt

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

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

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

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

a = A("a")
m = B("m")
k = C("k")
g = D("g")
l = E("l")
n = F("n")
e = C("e")
b = E("b")
i = D("i")

a.p = n
m.s = n
m.y = n
m.u = a
m.q = a
m.z = i
k.s = i
k.z = g
k.u = e
k.p = e
g.p = m
l.x = b
l.r = a
n.u = e
n.w = l
n.p = a
e.s = i
e.z = i
e.u = k
e.p = k
b.x = l
b.r = a
i.p = m
assert i.p.z.p.u.p.w.txt == "l"