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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
i = C("i")
c = D("c")
a = E("a")
n = F("n")

k.t = i
f.x = k
f.w = i
f.q = c
i.o = a
c.x = n
a.r = k
a.v = n
a.u = n
a.t = c
n.q = c
assert c.x.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
i = C("i")
c = D("c")
a = E("a")
n = F("n")

k.t = i
f.x = k
f.w = i
f.q = c
i.o = a
c.x = n
a.r = k
a.v = n
a.u = n
a.t = c
n.q = c
assert c.x.q.x.txt == "n"