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

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

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

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

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

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

j = A("j")
a = B("a")
i = C("i")
l = D("l")
f = E("f")
k = F("k")

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

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

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

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

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

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

j = A("j")
a = B("a")
i = C("i")
l = D("l")
f = E("f")
k = F("k")

j.s = f
j.r = f
j.w = f
a.q = i
a.v = f
i.v = a
l.z = j
l.q = a
l.x = a
l.r = k
f.w = j
f.z = a
k.r = j
assert f.w.w.w.r.w.txt == "j"