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

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

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

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

f = A("f")
m = B("m")
h = C("h")
e = D("e")
a = C("a")
l = C("l")
n = A("n")
g = B("g")

f.r = e
f.z = e
m.o = n
m.w = a
h.r = f
h.t = f
h.u = m
e.y = l
a.r = n
a.u = g
a.t = f
l.r = f
l.t = f
l.u = m
n.r = e
n.z = e
g.o = n
g.w = h
assert n.z.y.u.o.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: D = None
        self.txt = txt

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

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

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

f = A("f")
m = B("m")
h = C("h")
e = D("e")
a = C("a")
l = C("l")
n = A("n")
g = B("g")

f.r = e
f.z = e
m.o = n
m.w = a
h.r = f
h.t = f
h.u = m
e.y = l
a.r = n
a.u = g
a.t = f
l.r = f
l.t = f
l.u = m
n.r = e
n.z = e
g.o = n
g.w = h
assert n.z.y.u.o.r.y.txt == "l"