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

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

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

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

m = A("m")
c = B("c")
b = C("b")
h = D("h")
n = B("n")
j = C("j")
a = C("a")
k = B("k")

m.o = b
c.r = j
c.y = k
c.q = m
c.x = m
b.y = m
b.v = m
b.s = a
h.x = a
h.v = c
n.r = j
n.y = k
n.q = m
n.x = m
j.y = m
j.v = m
j.s = a
a.y = m
a.v = m
a.s = j
k.r = b
k.y = n
k.q = m
k.x = m
assert h.v.q.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

m = A("m")
c = B("c")
b = C("b")
h = D("h")
n = B("n")
j = C("j")
a = C("a")
k = B("k")

m.o = b
c.r = j
c.y = k
c.q = m
c.x = m
b.y = m
b.v = m
b.s = a
h.x = a
h.v = c
n.r = j
n.y = k
n.q = m
n.x = m
j.y = m
j.v = m
j.s = a
a.y = m
a.v = m
a.s = j
k.r = b
k.y = n
k.q = m
k.x = m
assert h.v.q.o.y.txt == "m"