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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: D = None
        self.u: B = None
        self.p: A = None
        self.w: B = None
        self.txt = txt

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

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

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

b = A("b")
f = B("f")
l = C("l")
n = D("n")
c = E("c")
d = F("d")
a = F("a")
i = B("i")

b.z = i
f.s = i
l.v = n
l.z = n
l.u = f
l.p = b
l.w = i
n.w = b
c.r = i
d.q = l
d.r = b
d.z = n
a.q = l
a.r = b
a.z = n
i.s = f
assert n.w.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: D = None
        self.u: B = None
        self.p: A = None
        self.w: B = None
        self.txt = txt

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

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

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

b = A("b")
f = B("f")
l = C("l")
n = D("n")
c = E("c")
d = F("d")
a = F("a")
i = B("i")

b.z = i
f.s = i
l.v = n
l.z = n
l.u = f
l.p = b
l.w = i
n.w = b
c.r = i
d.q = l
d.r = b
d.z = n
a.q = l
a.r = b
a.z = n
i.s = f
assert n.w.z.s.txt == "f"