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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: A = None
        self.o: A = None
        self.u: D = None
        self.txt = txt

c = A("c")
d = B("d")
i = C("i")
a = D("a")
m = B("m")
e = C("e")
b = B("b")
j = D("j")

c.s = m
c.v = e
c.r = a
d.r = i
i.x = b
i.v = e
i.y = c
i.q = j
a.y = c
a.p = c
a.o = c
a.u = j
m.r = i
e.x = d
e.v = i
e.y = c
e.q = a
b.r = i
j.y = c
j.p = c
j.o = c
j.u = a
assert e.x.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: C = None
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: A = None
        self.o: A = None
        self.u: D = None
        self.txt = txt

c = A("c")
d = B("d")
i = C("i")
a = D("a")
m = B("m")
e = C("e")
b = B("b")
j = D("j")

c.s = m
c.v = e
c.r = a
d.r = i
i.x = b
i.v = e
i.y = c
i.q = j
a.y = c
a.p = c
a.o = c
a.u = j
m.r = i
e.x = d
e.v = i
e.y = c
e.q = a
b.r = i
j.y = c
j.p = c
j.o = c
j.u = a
assert e.x.r.x.txt == "b"