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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: D = None
        self.z: B = None
        self.w: F = None
        self.q: B = None
        self.txt = txt

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

k = A("k")
f = B("f")
l = C("l")
m = D("m")
b = E("b")
j = F("j")

k.w = j
f.p = m
l.u = m
l.s = k
m.r = b
b.o = f
b.z = f
b.q = f
b.v = m
b.w = j
j.v = b
j.r = b
assert j.r.w.v.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: D = None
        self.z: B = None
        self.w: F = None
        self.q: B = None
        self.txt = txt

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

k = A("k")
f = B("f")
l = C("l")
m = D("m")
b = E("b")
j = F("j")

k.w = j
f.p = m
l.u = m
l.s = k
m.r = b
b.o = f
b.z = f
b.q = f
b.v = m
b.w = j
j.v = b
j.r = b
assert j.r.w.v.w.r.txt == "b"