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

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

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

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

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

h.v = k
h.w = f
h.x = n
m.y = d
m.t = e
i.u = k
i.w = c
d.q = c
d.z = e
k.y = d
k.t = e
e.y = d
e.t = m
f.v = m
f.w = h
f.x = c
n.u = e
n.w = i
c.u = k
c.w = n
assert e.y.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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

h.v = k
h.w = f
h.x = n
m.y = d
m.t = e
i.u = k
i.w = c
d.q = c
d.z = e
k.y = d
k.t = e
e.y = d
e.t = m
f.v = m
f.w = h
f.x = c
n.u = e
n.w = i
c.u = k
c.w = n
assert e.y.z.y.z.txt == "e"