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

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

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

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

c = A("c")
j = B("j")
k = C("k")
d = D("d")
h = A("h")
e = C("e")
n = B("n")
l = D("l")
m = A("m")

c.t = l
j.z = n
j.y = n
k.w = h
k.y = d
k.o = l
d.q = j
d.t = l
d.y = e
d.o = k
h.t = d
e.w = m
e.y = l
e.o = d
n.z = j
n.y = j
l.q = j
l.t = d
l.y = k
l.o = k
m.t = l
assert k.w.t.o.o.q.z.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
k = C("k")
d = D("d")
h = A("h")
e = C("e")
n = B("n")
l = D("l")
m = A("m")

c.t = l
j.z = n
j.y = n
k.w = h
k.y = d
k.o = l
d.q = j
d.t = l
d.y = e
d.o = k
h.t = d
e.w = m
e.y = l
e.o = d
n.z = j
n.y = j
l.q = j
l.t = d
l.y = k
l.o = k
m.t = l
assert k.w.t.o.o.q.z.y.y.txt == "n"