class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: D = None
        self.x: A = None
        self.txt = txt

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

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

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

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

l.w = b
l.o = b
l.x = n
m.q = j
m.s = c
c.z = b
c.y = b
c.u = j
b.v = m
n.w = b
n.o = b
n.x = l
a.z = b
a.y = b
a.u = m
e.w = b
e.o = b
e.x = n
j.q = m
j.s = a
assert j.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: D = None
        self.x: A = None
        self.txt = txt

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

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

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

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

l.w = b
l.o = b
l.x = n
m.q = j
m.s = c
c.z = b
c.y = b
c.u = j
b.v = m
n.w = b
n.o = b
n.x = l
a.z = b
a.y = b
a.u = m
e.w = b
e.o = b
e.x = n
j.q = m
j.s = a
assert j.q.q.q.txt == "m"