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

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

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

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

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

n.s = h
m.t = n
h.z = n
h.v = n
h.p = c
c.q = i
c.v = n
b.t = n
i.q = c
i.v = n
l.z = n
l.v = n
l.p = i
j.z = n
j.v = n
j.p = c
f.z = n
f.v = n
f.p = i
assert c.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

n.s = h
m.t = n
h.z = n
h.v = n
h.p = c
c.q = i
c.v = n
b.t = n
i.q = c
i.v = n
l.z = n
l.v = n
l.p = i
j.z = n
j.v = n
j.p = c
f.z = n
f.v = n
f.p = i
assert c.q.q.q.txt == "i"