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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: C = None
        self.t: A = None
        self.txt = txt

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

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

e.u = c
e.x = m
e.p = m
e.s = j
j.v = m
j.q = b
b.u = m
b.s = i
b.t = e
c.q = j
c.u = n
n.v = m
n.q = i
l.u = g
l.x = e
l.s = j
l.p = a
g.q = j
g.u = n
i.u = a
i.s = b
i.t = l
m.u = c
m.x = l
m.p = l
m.s = n
a.u = c
a.x = l
a.s = n
a.p = m
assert l.u.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: A = None
        self.s: B = None
        self.p: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: C = None
        self.t: A = None
        self.txt = txt

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

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

e.u = c
e.x = m
e.p = m
e.s = j
j.v = m
j.q = b
b.u = m
b.s = i
b.t = e
c.q = j
c.u = n
n.v = m
n.q = i
l.u = g
l.x = e
l.s = j
l.p = a
g.q = j
g.u = n
i.u = a
i.s = b
i.t = l
m.u = c
m.x = l
m.p = l
m.s = n
a.u = c
a.x = l
a.s = n
a.p = m
assert l.u.u.v.txt == "m"