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

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

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

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

h = A("h")
e = B("e")
g = C("g")
b = D("b")
d = B("d")
m = A("m")
a = A("a")
f = C("f")

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

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

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

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

h = A("h")
e = B("e")
g = C("g")
b = D("b")
d = B("d")
m = A("m")
a = A("a")
f = C("f")

h.v = e
h.t = b
h.u = b
h.z = d
e.y = b
e.v = d
g.r = b
b.o = d
d.y = b
d.v = e
m.v = d
m.t = b
m.u = b
m.z = e
a.v = d
a.t = b
a.u = b
a.z = e
f.r = b
assert f.r.o.y.o.y.o.v.txt == "e"