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

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

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

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

m = A("m")
j = B("j")
b = C("b")
e = D("e")
h = C("h")
c = C("c")
l = B("l")
n = D("n")

m.o = h
m.r = h
j.r = e
j.t = c
j.y = m
b.u = n
b.z = j
b.o = l
b.q = l
e.s = n
e.x = n
e.p = m
e.v = c
h.u = n
h.z = l
h.q = l
h.o = j
c.u = n
c.z = l
c.o = j
c.q = j
l.r = n
l.t = c
l.y = m
n.s = e
n.x = e
n.p = m
n.v = h
assert h.q.y.r.u.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: C = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
b = C("b")
e = D("e")
h = C("h")
c = C("c")
l = B("l")
n = D("n")

m.o = h
m.r = h
j.r = e
j.t = c
j.y = m
b.u = n
b.z = j
b.o = l
b.q = l
e.s = n
e.x = n
e.p = m
e.v = c
h.u = n
h.z = l
h.q = l
h.o = j
c.u = n
c.z = l
c.o = j
c.q = j
l.r = n
l.t = c
l.y = m
n.s = e
n.x = e
n.p = m
n.v = h
assert h.q.y.r.u.v.o.txt == "j"