class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

i = A("i")
n = B("n")
j = C("j")
h = D("h")
b = E("b")

i.p = b
n.t = i
n.q = h
n.v = h
n.x = b
j.y = i
j.v = i
j.s = h
h.v = i
b.w = n
b.s = n
b.v = h
b.o = j
assert n.t.p.w.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

i = A("i")
n = B("n")
j = C("j")
h = D("h")
b = E("b")

i.p = b
n.t = i
n.q = h
n.v = h
n.x = b
j.y = i
j.v = i
j.s = h
h.v = i
b.w = n
b.s = n
b.v = h
b.o = j
assert n.t.p.w.x.o.txt == "j"