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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: F = None
        self.v: B = None
        self.s: F = None
        self.txt = txt

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

k = A("k")
a = B("a")
e = C("e")
d = D("d")
b = E("b")
g = F("g")

k.r = e
a.z = k
e.q = g
d.z = a
b.t = a
b.v = a
b.y = g
b.s = g
g.w = k
assert e.q.w.r.q.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: F = None
        self.v: B = None
        self.s: F = None
        self.txt = txt

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

k = A("k")
a = B("a")
e = C("e")
d = D("d")
b = E("b")
g = F("g")

k.r = e
a.z = k
e.q = g
d.z = a
b.t = a
b.v = a
b.y = g
b.s = g
g.w = k
assert e.q.w.r.q.w.r.txt == "e"