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

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: D = None
        self.txt = txt

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

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

e.w = g
e.x = k
e.q = b
m.t = b
g.v = b
k.x = e
a.o = b
a.t = k
b.p = g
b.w = k
b.r = m
assert k.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: D = None
        self.q: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: D = None
        self.txt = txt

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

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

e.w = g
e.x = k
e.q = b
m.t = b
g.v = b
k.x = e
a.o = b
a.t = k
b.p = g
b.w = k
b.r = m
assert k.x.x.x.txt == "e"