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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: B = None
        self.r: B = None
        self.y: B = None
        self.txt = txt

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

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

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

d = A("d")
f = B("f")
i = C("i")
a = D("a")
g = E("g")
b = F("b")

d.t = f
f.x = d
f.u = d
f.t = b
f.o = b
f.p = g
i.o = f
i.u = f
i.r = f
i.y = f
a.s = d
a.r = d
g.o = f
g.w = f
g.p = i
b.x = d
b.w = d
b.q = a
assert f.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: B = None
        self.r: B = None
        self.y: B = None
        self.txt = txt

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

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

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

d = A("d")
f = B("f")
i = C("i")
a = D("a")
g = E("g")
b = F("b")

d.t = f
f.x = d
f.u = d
f.t = b
f.o = b
f.p = g
i.o = f
i.u = f
i.r = f
i.y = f
a.s = d
a.r = d
g.o = f
g.w = f
g.p = i
b.x = d
b.w = d
b.q = a
assert f.t.x.t.txt == "f"