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

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

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

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

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

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

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

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

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

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

c.o = k
c.u = e
k.w = f
h.u = d
h.x = d
h.t = g
h.v = m
e.u = g
e.s = k
e.q = b
b.o = g
b.u = l
m.o = g
m.u = d
l.u = g
l.s = k
l.q = m
g.w = f
f.o = k
f.u = e
d.u = k
d.s = g
d.q = b
assert d.s.w.u.u.w.o.w.u.u.w.txt == "f"