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

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

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

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

e = A("e")
m = B("m")
j = C("j")
f = D("f")

e.y = j
e.o = j
e.t = j
e.z = m
m.u = j
j.u = f
j.p = e
f.v = m
assert f.v.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: C = None
        self.t: C = None
        self.z: B = None
        self.txt = txt

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

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

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

e = A("e")
m = B("m")
j = C("j")
f = D("f")

e.y = j
e.o = j
e.t = j
e.z = m
m.u = j
j.u = f
j.p = e
f.v = m
assert f.v.u.p.txt == "e"