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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: B = None
        self.q: A = None
        self.y: E = None
        self.o: D = None
        self.txt = txt

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

n.o = k
n.t = f
f.w = b
f.z = n
a.o = b
a.q = b
c.y = n
b.u = c
b.s = n
k.x = b
k.y = b
k.p = f
k.q = n
k.o = c
assert a.o.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: B = None
        self.q: A = None
        self.y: E = None
        self.o: D = None
        self.txt = txt

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

n.o = k
n.t = f
f.w = b
f.z = n
a.o = b
a.q = b
c.y = n
b.u = c
b.s = n
k.x = b
k.y = b
k.p = f
k.q = n
k.o = c
assert a.o.s.t.txt == "f"