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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.r: D = None
        self.txt = txt

j = A("j")
e = B("e")
h = C("h")
g = D("g")
d = B("d")
b = A("b")
a = D("a")
l = C("l")

j.q = h
e.y = a
e.t = h
e.v = g
h.y = d
h.w = g
h.p = g
h.u = e
g.p = e
g.v = e
g.r = a
d.y = g
d.v = g
d.t = l
b.q = h
a.p = d
a.v = e
a.r = g
l.y = e
l.u = e
l.w = g
l.p = g
assert j.q.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.r: D = None
        self.txt = txt

j = A("j")
e = B("e")
h = C("h")
g = D("g")
d = B("d")
b = A("b")
a = D("a")
l = C("l")

j.q = h
e.y = a
e.t = h
e.v = g
h.y = d
h.w = g
h.p = g
h.u = e
g.p = e
g.v = e
g.r = a
d.y = g
d.v = g
d.t = l
b.q = h
a.p = d
a.v = e
a.r = g
l.y = e
l.u = e
l.w = g
l.p = g
assert j.q.p.r.txt == "a"