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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: B = None
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

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

f.w = j
f.o = j
f.r = a
i.o = n
g.x = f
j.t = i
j.r = a
j.w = f
b.s = n
b.w = n
b.v = g
b.u = i
a.u = f
a.s = i
a.x = b
n.o = i
assert f.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: F = None
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: B = None
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

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

f.w = j
f.o = j
f.r = a
i.o = n
g.x = f
j.t = i
j.r = a
j.w = f
b.s = n
b.w = n
b.v = g
b.u = i
a.u = f
a.s = i
a.x = b
n.o = i
assert f.o.t.o.txt == "n"