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

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

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

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

e = A("e")
h = B("h")
f = C("f")
l = D("l")
j = A("j")
c = D("c")
n = B("n")
m = B("m")

e.y = f
e.s = f
e.p = m
h.y = c
f.v = h
f.q = e
l.z = c
j.y = f
j.s = f
j.p = h
c.z = l
n.y = l
m.y = l
assert m.y.z.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: C = None
        self.p: B = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
f = C("f")
l = D("l")
j = A("j")
c = D("c")
n = B("n")
m = B("m")

e.y = f
e.s = f
e.p = m
h.y = c
f.v = h
f.q = e
l.z = c
j.y = f
j.s = f
j.p = h
c.z = l
n.y = l
m.y = l
assert m.y.z.z.z.z.z.z.z.txt == "c"