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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

f = A("f")
c = B("c")
m = C("m")
b = D("b")
j = E("j")
i = B("i")
a = C("a")
n = E("n")

f.p = j
c.v = i
m.z = j
b.z = f
b.s = f
j.y = b
i.v = c
a.z = n
n.y = b
assert j.y.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

f = A("f")
c = B("c")
m = C("m")
b = D("b")
j = E("j")
i = B("i")
a = C("a")
n = E("n")

f.p = j
c.v = i
m.z = j
b.z = f
b.s = f
j.y = b
i.v = c
a.z = n
n.y = b
assert j.y.z.p.txt == "j"