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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: A = None
        self.txt = txt

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

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

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

g.t = h
g.w = h
g.x = n
g.v = b
h.t = n
h.o = i
b.q = f
b.p = g
i.r = f
f.s = g
n.q = f
n.p = g
assert f.s.x.q.s.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: B = None
        self.x: C = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: A = None
        self.txt = txt

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

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

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

g.t = h
g.w = h
g.x = n
g.v = b
h.t = n
h.o = i
b.q = f
b.p = g
i.r = f
f.s = g
n.q = f
n.p = g
assert f.s.x.q.s.w.t.txt == "n"