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

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

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

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

m = A("m")
l = B("l")
h = C("h")
i = D("i")
g = A("g")

m.o = h
m.v = l
l.u = h
l.v = h
l.t = h
l.x = g
h.t = l
h.x = l
h.v = l
h.w = m
i.x = g
i.v = h
g.o = h
g.v = l
assert i.x.o.x.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: B = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
h = C("h")
i = D("i")
g = A("g")

m.o = h
m.v = l
l.u = h
l.v = h
l.t = h
l.x = g
h.t = l
h.x = l
h.v = l
h.w = m
i.x = g
i.v = h
g.o = h
g.v = l
assert i.x.o.x.u.w.txt == "m"