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

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

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

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

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

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

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

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

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

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

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

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

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

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

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