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

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

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

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

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

a.y = n
a.q = e
a.v = i
a.w = i
e.p = l
e.u = n
e.v = j
n.q = d
n.u = d
b.t = n
j.t = n
k.p = l
k.u = n
k.v = b
d.t = n
f.p = a
f.u = i
f.v = j
l.y = n
l.q = k
l.v = i
l.w = i
i.q = j
i.u = b
assert a.q.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: B = None
        self.v: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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

a.y = n
a.q = e
a.v = i
a.w = i
e.p = l
e.u = n
e.v = j
n.q = d
n.u = d
b.t = n
j.t = n
k.p = l
k.u = n
k.v = b
d.t = n
f.p = a
f.u = i
f.v = j
l.y = n
l.q = k
l.v = i
l.w = i
i.q = j
i.u = b
assert a.q.p.y.txt == "n"