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

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

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

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

c = A("c")
m = B("m")
e = C("e")
b = D("b")
l = B("l")
f = B("f")
a = C("a")

c.w = e
c.s = l
m.w = f
m.u = c
m.v = b
e.r = m
b.q = l
b.v = a
b.x = a
l.w = m
l.u = c
l.v = b
f.w = m
f.u = c
f.v = b
a.r = m
assert a.r.v.q.v.q.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: B = None
        self.txt = txt

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

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

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

c = A("c")
m = B("m")
e = C("e")
b = D("b")
l = B("l")
f = B("f")
a = C("a")

c.w = e
c.s = l
m.w = f
m.u = c
m.v = b
e.r = m
b.q = l
b.v = a
b.x = a
l.w = m
l.u = c
l.v = b
f.w = m
f.u = c
f.v = b
a.r = m
assert a.r.v.q.v.q.v.v.txt == "a"