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

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

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

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

j = A("j")
d = B("d")
m = C("m")
f = D("f")
c = B("c")
i = D("i")
h = A("h")

j.o = c
j.w = m
j.y = m
d.q = m
m.s = c
f.y = h
f.t = h
f.q = j
f.s = m
c.q = m
i.y = j
i.q = j
i.t = h
i.s = m
h.o = c
h.w = m
h.y = m
assert h.o.q.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: C = None
        self.y: C = None
        self.txt = txt

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

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

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

j = A("j")
d = B("d")
m = C("m")
f = D("f")
c = B("c")
i = D("i")
h = A("h")

j.o = c
j.w = m
j.y = m
d.q = m
m.s = c
f.y = h
f.t = h
f.q = j
f.s = m
c.q = m
i.y = j
i.q = j
i.t = h
i.s = m
h.o = c
h.w = m
h.y = m
assert h.o.q.s.q.s.txt == "c"