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

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

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

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

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

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

f = A("f")
a = B("a")
n = C("n")
j = D("j")
c = E("c")
l = F("l")

f.p = c
a.z = c
n.s = a
j.q = n
j.x = n
j.r = l
c.y = j
c.v = j
c.w = j
l.s = j
assert c.w.q.s.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

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

f = A("f")
a = B("a")
n = C("n")
j = D("j")
c = E("c")
l = F("l")

f.p = c
a.z = c
n.s = a
j.q = n
j.x = n
j.r = l
c.y = j
c.v = j
c.w = j
l.s = j
assert c.w.q.s.z.v.txt == "j"