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

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

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

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

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

g.x = n
g.o = j
f.w = b
j.u = l
j.q = h
j.s = h
j.p = n
c.s = b
c.t = l
b.s = c
b.t = f
e.x = l
e.o = j
n.w = c
m.x = l
m.o = h
h.u = n
h.q = j
h.s = j
h.p = l
l.w = c
assert g.o.q.p.w.t.w.s.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

g.x = n
g.o = j
f.w = b
j.u = l
j.q = h
j.s = h
j.p = n
c.s = b
c.t = l
b.s = c
b.t = f
e.x = l
e.o = j
n.w = c
m.x = l
m.o = h
h.u = n
h.q = j
h.s = j
h.p = l
l.w = c
assert g.o.q.p.w.t.w.s.t.w.txt == "b"