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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: D = None
        self.q: C = None
        self.x: A = None
        self.txt = txt

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

l = A("l")
b = B("b")
c = C("c")
d = D("d")
n = C("n")
j = A("j")

l.w = j
l.q = d
l.p = b
l.o = b
b.q = j
c.z = d
c.s = d
c.q = n
c.x = j
d.r = l
d.o = n
d.v = c
n.z = d
n.s = d
n.q = c
n.x = l
j.w = l
j.q = d
j.p = b
j.o = b
assert j.o.q.q.o.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: D = None
        self.p: B = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: D = None
        self.q: C = None
        self.x: A = None
        self.txt = txt

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

l = A("l")
b = B("b")
c = C("c")
d = D("d")
n = C("n")
j = A("j")

l.w = j
l.q = d
l.p = b
l.o = b
b.q = j
c.z = d
c.s = d
c.q = n
c.x = j
d.r = l
d.o = n
d.v = c
n.z = d
n.s = d
n.q = c
n.x = l
j.w = l
j.q = d
j.p = b
j.o = b
assert j.o.q.q.o.x.p.txt == "b"