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

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

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

class D:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: A = None
        self.q: D = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: D = None
        self.t: A = None
        self.u: A = None
        self.q: C = None
        self.txt = txt

j = A("j")
a = B("a")
c = C("c")
f = D("f")
e = E("e")
h = B("h")
k = D("k")
b = D("b")

j.u = b
a.t = b
c.w = j
f.v = b
f.q = b
f.x = j
f.o = j
e.o = c
e.q = c
e.r = f
e.t = j
e.u = j
h.t = f
k.v = f
k.q = f
k.x = j
k.o = j
b.v = k
b.q = k
b.x = j
b.o = j
assert k.v.v.v.x.u.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: A = None
        self.q: D = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: D = None
        self.t: A = None
        self.u: A = None
        self.q: C = None
        self.txt = txt

j = A("j")
a = B("a")
c = C("c")
f = D("f")
e = E("e")
h = B("h")
k = D("k")
b = D("b")

j.u = b
a.t = b
c.w = j
f.v = b
f.q = b
f.x = j
f.o = j
e.o = c
e.q = c
e.r = f
e.t = j
e.u = j
h.t = f
k.v = f
k.q = f
k.x = j
k.o = j
b.v = k
b.q = k
b.x = j
b.o = j
assert k.v.v.v.x.u.v.o.txt == "j"