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

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

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

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

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

l = A("l")
b = B("b")
h = C("h")
j = D("j")
d = E("d")
i = B("i")
f = C("f")
c = E("c")
m = A("m")

l.q = i
l.r = m
b.u = j
h.v = m
j.x = f
j.y = c
j.t = l
d.w = j
i.u = j
f.v = m
c.w = j
m.q = b
m.r = l
assert m.r.q.u.x.v.r.q.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: A = None
        self.txt = txt

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

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

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

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

l = A("l")
b = B("b")
h = C("h")
j = D("j")
d = E("d")
i = B("i")
f = C("f")
c = E("c")
m = A("m")

l.q = i
l.r = m
b.u = j
h.v = m
j.x = f
j.y = c
j.t = l
d.w = j
i.u = j
f.v = m
c.w = j
m.q = b
m.r = l
assert m.r.q.u.x.v.r.q.u.y.txt == "c"