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

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

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

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

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

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

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

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

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

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

b.z = j
b.w = l
b.y = a
c.p = h
c.w = h
c.v = f
n.p = j
f.z = j
j.p = n
l.p = h
l.v = h
l.w = h
a.p = h
a.v = f
a.w = f
h.z = j
assert l.p.z.p.p.txt == "j"