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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.u: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: B = None
        self.txt = txt

k = A("k")
m = B("m")
g = C("g")
d = D("d")
l = E("l")
j = E("j")
n = B("n")

k.p = n
k.v = g
m.s = j
g.o = n
g.v = n
g.u = l
d.r = g
d.q = g
d.s = n
l.r = k
l.t = m
j.r = k
j.t = n
n.s = l
assert l.t.s.r.p.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.u: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: B = None
        self.txt = txt

k = A("k")
m = B("m")
g = C("g")
d = D("d")
l = E("l")
j = E("j")
n = B("n")

k.p = n
k.v = g
m.s = j
g.o = n
g.v = n
g.u = l
d.r = g
d.q = g
d.s = n
l.r = k
l.t = m
j.r = k
j.t = n
n.s = l
assert l.t.s.r.p.s.t.txt == "m"