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

class B:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: E = None
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: G = None
        self.txt = txt

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

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

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

k = A("k")
d = B("d")
f = C("f")
h = D("h")
j = E("j")
b = F("b")
e = G("e")

k.o = b
d.t = e
d.x = k
f.z = j
f.q = j
f.s = b
h.x = j
h.u = e
j.r = e
j.o = k
b.w = e
e.x = j
assert f.s.w.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: E = None
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: G = None
        self.txt = txt

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

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

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

k = A("k")
d = B("d")
f = C("f")
h = D("h")
j = E("j")
b = F("b")
e = G("e")

k.o = b
d.t = e
d.x = k
f.z = j
f.q = j
f.s = b
h.x = j
h.u = e
j.r = e
j.o = k
b.w = e
e.x = j
assert f.s.w.x.r.txt == "e"