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

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

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

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

h = A("h")
i = B("i")
c = C("c")
f = D("f")
j = B("j")
b = B("b")
l = D("l")
d = A("d")
n = B("n")

h.v = c
i.z = c
i.w = l
i.y = j
c.z = f
f.u = l
f.r = h
j.z = c
j.w = f
j.y = b
b.z = c
b.w = l
b.y = j
l.u = f
l.r = d
d.v = c
n.z = c
n.w = f
n.y = j
assert b.y.z.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

h = A("h")
i = B("i")
c = C("c")
f = D("f")
j = B("j")
b = B("b")
l = D("l")
d = A("d")
n = B("n")

h.v = c
i.z = c
i.w = l
i.y = j
c.z = f
f.u = l
f.r = h
j.z = c
j.w = f
j.y = b
b.z = c
b.w = l
b.y = j
l.u = f
l.r = d
d.v = c
n.z = c
n.w = f
n.y = j
assert b.y.z.z.u.txt == "l"