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

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

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

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

g = A("g")
h = B("h")
j = C("j")
c = D("c")
d = B("d")
n = C("n")
a = D("a")
k = D("k")
l = D("l")

g.x = d
g.w = d
g.o = d
g.t = d
h.q = g
j.o = h
j.w = k
c.s = g
c.r = k
d.q = g
n.o = d
n.w = l
a.s = g
a.r = l
k.s = g
k.r = l
l.s = g
l.r = c
assert k.s.x.q.w.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: B = None
        self.o: B = None
        self.t: B = None
        self.txt = txt

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

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

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

g = A("g")
h = B("h")
j = C("j")
c = D("c")
d = B("d")
n = C("n")
a = D("a")
k = D("k")
l = D("l")

g.x = d
g.w = d
g.o = d
g.t = d
h.q = g
j.o = h
j.w = k
c.s = g
c.r = k
d.q = g
n.o = d
n.w = l
a.s = g
a.r = l
k.s = g
k.r = l
l.s = g
l.r = c
assert k.s.x.q.w.q.o.txt == "d"