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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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