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

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

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

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

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

a.r = n
a.y = c
j.s = g
j.u = g
j.o = n
j.z = a
m.y = h
m.o = j
m.r = n
c.s = h
c.x = f
g.y = a
g.o = j
g.r = n
h.r = g
h.y = f
f.s = h
f.x = c
n.y = h
n.o = j
n.r = g
l.s = h
l.x = f
assert m.y.y.s.r.o.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: D = None
        self.txt = txt

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

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

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

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

a.r = n
a.y = c
j.s = g
j.u = g
j.o = n
j.z = a
m.y = h
m.o = j
m.r = n
c.s = h
c.x = f
g.y = a
g.o = j
g.r = n
h.r = g
h.y = f
f.s = h
f.x = c
n.y = h
n.o = j
n.r = g
l.s = h
l.x = f
assert m.y.y.s.r.o.o.r.txt == "g"