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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.o: E = None
        self.u: A = None
        self.txt = txt

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

j = A("j")
m = B("m")
g = C("g")
h = D("h")
b = E("b")
f = D("f")

j.s = h
m.v = j
m.t = g
m.o = g
g.x = m
g.y = j
h.r = m
h.z = f
h.o = b
h.u = j
b.y = m
b.w = m
b.v = g
f.r = m
f.z = h
f.o = b
f.u = j
assert g.y.s.u.s.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.o: E = None
        self.u: A = None
        self.txt = txt

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

j = A("j")
m = B("m")
g = C("g")
h = D("h")
b = E("b")
f = D("f")

j.s = h
m.v = j
m.t = g
m.o = g
g.x = m
g.y = j
h.r = m
h.z = f
h.o = b
h.u = j
b.y = m
b.w = m
b.v = g
f.r = m
f.z = h
f.o = b
f.u = j
assert g.y.s.u.s.z.u.txt == "j"