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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: C = None
        self.x: E = None
        self.t: C = None
        self.txt = txt

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

a = A("a")
c = B("c")
i = C("i")
j = D("j")
g = E("g")
f = C("f")
m = B("m")

a.t = j
c.v = g
i.q = j
j.u = f
j.s = f
j.t = f
j.x = g
g.s = c
g.v = m
g.o = j
f.q = j
m.v = g
assert i.q.x.o.t.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: C = None
        self.x: E = None
        self.t: C = None
        self.txt = txt

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

a = A("a")
c = B("c")
i = C("i")
j = D("j")
g = E("g")
f = C("f")
m = B("m")

a.t = j
c.v = g
i.q = j
j.u = f
j.s = f
j.t = f
j.x = g
g.s = c
g.v = m
g.o = j
f.q = j
m.v = g
assert i.q.x.o.t.q.t.txt == "f"