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

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

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

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

j = A("j")
d = B("d")
e = C("e")
m = D("m")
f = D("f")
g = B("g")
n = A("n")
l = D("l")

j.q = e
d.q = e
d.x = e
e.o = n
e.u = f
e.t = f
e.r = g
m.y = d
f.y = d
g.q = e
g.x = e
n.q = e
l.y = g
assert d.x.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

j = A("j")
d = B("d")
e = C("e")
m = D("m")
f = D("f")
g = B("g")
n = A("n")
l = D("l")

j.q = e
d.q = e
d.x = e
e.o = n
e.u = f
e.t = f
e.r = g
m.y = d
f.y = d
g.q = e
g.x = e
n.q = e
l.y = g
assert d.x.o.q.txt == "e"