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

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

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

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

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

l.w = n
l.s = m
l.q = b
a.p = i
a.t = n
a.q = k
n.p = i
m.t = a
m.r = j
m.x = c
m.q = n
j.w = i
j.s = e
j.q = l
b.w = n
b.s = e
b.q = j
c.t = a
c.r = b
c.x = m
c.q = i
k.p = i
k.t = i
k.q = a
i.p = n
e.t = a
e.r = b
e.x = m
e.q = n
assert a.q.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: D = None
        self.q: A = None
        self.txt = txt

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

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

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

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

l.w = n
l.s = m
l.q = b
a.p = i
a.t = n
a.q = k
n.p = i
m.t = a
m.r = j
m.x = c
m.q = n
j.w = i
j.s = e
j.q = l
b.w = n
b.s = e
b.q = j
c.t = a
c.r = b
c.x = m
c.q = i
k.p = i
k.t = i
k.q = a
i.p = n
e.t = a
e.r = b
e.x = m
e.q = n
assert a.q.q.t.txt == "n"