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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.p: A = None
        self.txt = txt

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

b = A("b")
n = B("n")
m = C("m")
l = D("l")
f = B("f")
h = C("h")
d = A("d")
a = A("a")

b.y = m
n.z = f
n.s = l
n.u = l
n.v = h
m.v = h
m.o = l
m.p = b
l.r = d
l.u = m
f.z = n
f.s = l
f.u = l
f.v = m
h.v = m
h.o = l
h.p = b
d.y = h
a.y = h
assert f.v.v.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.p: A = None
        self.txt = txt

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

b = A("b")
n = B("n")
m = C("m")
l = D("l")
f = B("f")
h = C("h")
d = A("d")
a = A("a")

b.y = m
n.z = f
n.s = l
n.u = l
n.v = h
m.v = h
m.o = l
m.p = b
l.r = d
l.u = m
f.z = n
f.s = l
f.u = l
f.v = m
h.v = m
h.o = l
h.p = b
d.y = h
a.y = h
assert f.v.v.v.p.txt == "b"