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

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

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

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

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

i = A("i")
b = B("b")
n = C("n")
d = D("d")
f = E("f")
k = D("k")
c = D("c")

i.s = d
b.u = i
b.s = f
b.w = n
b.o = n
n.y = b
d.o = f
d.w = i
f.o = b
f.t = b
k.o = f
k.w = i
c.o = f
c.w = i
assert i.s.w.s.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

i = A("i")
b = B("b")
n = C("n")
d = D("d")
f = E("f")
k = D("k")
c = D("c")

i.s = d
b.u = i
b.s = f
b.w = n
b.o = n
n.y = b
d.o = f
d.w = i
f.o = b
f.t = b
k.o = f
k.w = i
c.o = f
c.w = i
assert i.s.w.s.o.o.txt == "b"