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

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

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

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

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

e.s = h
i.v = e
f.s = e
f.w = c
f.y = i
k.p = h
k.q = f
k.t = c
k.z = e
c.s = e
c.w = f
c.y = i
h.s = e
assert c.y.v.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

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

e.s = h
i.v = e
f.s = e
f.w = c
f.y = i
k.p = h
k.q = f
k.t = c
k.z = e
c.s = e
c.w = f
c.y = i
h.s = e
assert c.y.v.s.s.s.txt == "h"