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

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

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

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

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

f = A("f")
i = B("i")
a = C("a")
l = D("l")
j = E("j")
c = B("c")

f.o = a
f.x = l
i.y = a
a.v = i
l.p = j
j.z = i
j.s = l
c.y = a
assert a.v.y.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: D = None
        self.txt = txt

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

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

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

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

f = A("f")
i = B("i")
a = C("a")
l = D("l")
j = E("j")
c = B("c")

f.o = a
f.x = l
i.y = a
a.v = i
l.p = j
j.z = i
j.s = l
c.y = a
assert a.v.y.v.y.v.txt == "i"