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

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

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

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

c = A("c")
k = B("k")
e = C("e")
n = D("n")
f = D("f")
g = B("g")
h = B("h")
j = B("j")

c.v = n
c.p = j
c.y = j
c.u = e
k.o = e
k.z = j
k.v = c
e.q = c
n.w = e
n.t = e
n.y = e
n.q = h
f.w = e
f.t = e
f.y = e
f.q = h
g.o = e
g.z = h
g.v = c
h.o = e
h.z = k
h.v = c
j.o = e
j.z = k
j.v = c
assert f.q.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: B = None
        self.y: B = None
        self.u: C = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
e = C("e")
n = D("n")
f = D("f")
g = B("g")
h = B("h")
j = B("j")

c.v = n
c.p = j
c.y = j
c.u = e
k.o = e
k.z = j
k.v = c
e.q = c
n.w = e
n.t = e
n.y = e
n.q = h
f.w = e
f.t = e
f.y = e
f.q = h
g.o = e
g.z = h
g.v = c
h.o = e
h.z = k
h.v = c
j.o = e
j.z = k
j.v = c
assert f.q.z.z.z.txt == "k"