class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: 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: C = None
        self.t: B = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

e.o = l
e.w = h
b.w = i
d.u = m
d.t = f
d.q = i
h.u = d
f.w = i
i.o = n
i.w = j
m.u = d
m.t = n
m.q = i
j.u = d
l.w = e
n.w = i
assert i.w.u.u.q.o.w.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: 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: C = None
        self.t: B = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

e.o = l
e.w = h
b.w = i
d.u = m
d.t = f
d.q = i
h.u = d
f.w = i
i.o = n
i.w = j
m.u = d
m.t = n
m.q = i
j.u = d
l.w = e
n.w = i
assert i.w.u.u.q.o.w.o.w.txt == "i"