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

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

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

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

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

l = A("l")
h = B("h")
e = C("e")
c = D("c")
m = E("m")
f = E("f")
a = E("a")
j = B("j")
k = C("k")

l.q = m
l.r = m
l.x = e
h.p = k
e.p = k
e.w = c
c.v = l
c.r = e
c.q = e
m.t = k
m.x = h
f.t = k
f.x = j
a.t = e
a.x = h
j.p = k
k.p = e
k.w = c
assert c.v.q.t.w.v.r.t.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: C = None
        self.r: E = None
        self.txt = txt

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

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

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

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

l = A("l")
h = B("h")
e = C("e")
c = D("c")
m = E("m")
f = E("f")
a = E("a")
j = B("j")
k = C("k")

l.q = m
l.r = m
l.x = e
h.p = k
e.p = k
e.w = c
c.v = l
c.r = e
c.q = e
m.t = k
m.x = h
f.t = k
f.x = j
a.t = e
a.x = h
j.p = k
k.p = e
k.w = c
assert c.v.q.t.w.v.r.t.w.v.txt == "l"