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

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

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

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

e = A("e")
c = B("c")
n = C("n")
h = D("h")
k = C("k")
f = A("f")

e.z = k
e.r = n
e.y = h
c.v = k
c.t = f
n.s = c
n.w = c
n.t = h
n.y = k
h.o = c
k.s = c
k.w = c
k.t = h
k.y = n
f.z = n
f.r = k
f.y = h
assert e.y.o.t.y.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: C = None
        self.y: D = None
        self.txt = txt

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

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

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

e = A("e")
c = B("c")
n = C("n")
h = D("h")
k = C("k")
f = A("f")

e.z = k
e.r = n
e.y = h
c.v = k
c.t = f
n.s = c
n.w = c
n.t = h
n.y = k
h.o = c
k.s = c
k.w = c
k.t = h
k.y = n
f.z = n
f.r = k
f.y = h
assert e.y.o.t.y.o.t.txt == "f"