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

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

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

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

n = A("n")
b = B("b")
g = C("g")
j = D("j")
f = A("f")
h = B("h")
c = D("c")
l = C("l")
a = D("a")

n.y = f
n.r = b
n.w = l
n.q = g
b.z = l
b.u = l
b.o = n
b.r = h
g.y = l
g.o = h
g.w = n
j.v = c
j.q = g
f.y = n
f.r = h
f.w = l
f.q = l
h.z = g
h.u = l
h.o = f
h.r = b
c.v = j
c.q = g
l.y = g
l.o = h
l.w = f
a.v = j
a.q = l
assert b.r.o.y.y.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: B = None
        self.w: C = None
        self.q: C = None
        self.txt = txt

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

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

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

n = A("n")
b = B("b")
g = C("g")
j = D("j")
f = A("f")
h = B("h")
c = D("c")
l = C("l")
a = D("a")

n.y = f
n.r = b
n.w = l
n.q = g
b.z = l
b.u = l
b.o = n
b.r = h
g.y = l
g.o = h
g.w = n
j.v = c
j.q = g
f.y = n
f.r = h
f.w = l
f.q = l
h.z = g
h.u = l
h.o = f
h.r = b
c.v = j
c.q = g
l.y = g
l.o = h
l.w = f
a.v = j
a.q = l
assert b.r.o.y.y.r.r.txt == "b"