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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.v: A = None
        self.s: A = None
        self.u: D = None
        self.txt = txt

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

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

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

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

e.s = j
m.y = e
m.t = e
m.v = e
m.s = e
m.u = j
f.s = e
f.y = d
f.v = m
f.q = j
h.t = m
h.p = f
d.y = m
j.t = m
j.p = f
g.y = e
g.t = e
g.v = e
g.s = e
g.u = j
assert f.y.y.u.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.v: A = None
        self.s: A = None
        self.u: D = None
        self.txt = txt

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

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

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

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

e.s = j
m.y = e
m.t = e
m.v = e
m.s = e
m.u = j
f.s = e
f.y = d
f.v = m
f.q = j
h.t = m
h.p = f
d.y = m
j.t = m
j.p = f
g.y = e
g.t = e
g.v = e
g.s = e
g.u = j
assert f.y.y.u.p.q.txt == "j"