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

class B:
    def __init__(self, txt: str):
        self.o: A = 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.w: C = None
        self.v: A = None
        self.txt = txt

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

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

j.p = g
j.s = g
j.t = g
j.q = k
j.y = d
d.o = j
g.w = j
k.w = g
k.v = h
f.w = k
h.p = g
h.s = g
h.t = g
h.q = k
h.y = d
assert k.v.s.w.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: D = None
        self.s: C = None
        self.t: C = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = 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.w: C = None
        self.v: A = None
        self.txt = txt

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

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

j.p = g
j.s = g
j.t = g
j.q = k
j.y = d
d.o = j
g.w = j
k.w = g
k.v = h
f.w = k
h.p = g
h.s = g
h.t = g
h.q = k
h.y = d
assert k.v.s.w.y.o.txt == "j"