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

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

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

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

l = A("l")
c = B("c")
m = C("m")
e = D("e")
n = C("n")
i = A("i")
a = B("a")
g = C("g")
j = D("j")
k = D("k")

l.q = i
l.o = i
c.x = g
c.y = k
m.p = a
e.w = a
n.p = a
i.q = l
i.o = l
a.x = m
a.y = k
g.p = c
j.w = a
k.w = a
assert e.w.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: A = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
m = C("m")
e = D("e")
n = C("n")
i = A("i")
a = B("a")
g = C("g")
j = D("j")
k = D("k")

l.q = i
l.o = i
c.x = g
c.y = k
m.p = a
e.w = a
n.p = a
i.q = l
i.o = l
a.x = m
a.y = k
g.p = c
j.w = a
k.w = a
assert e.w.y.w.txt == "a"