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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: B = None
        self.s: B = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: B = None
        self.s: B = None
        self.v: D = None
        self.txt = txt

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

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

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

g.w = i
l.s = b
b.q = i
b.v = i
b.o = l
b.s = l
i.w = l
i.t = b
n.q = i
a.w = i
f.q = i
f.v = i
f.o = l
f.s = l
assert i.t.v.t.s.s.v.txt == "i"