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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: C = None
        self.txt = txt

m = A("m")
l = B("l")
a = C("a")
b = D("b")
h = A("h")

m.o = b
m.x = b
m.v = b
l.z = h
l.w = a
l.t = b
a.z = h
b.q = a
b.t = a
h.o = b
h.x = b
h.v = b
assert l.t.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: D = None
        self.v: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: C = None
        self.txt = txt

m = A("m")
l = B("l")
a = C("a")
b = D("b")
h = A("h")

m.o = b
m.x = b
m.v = b
l.z = h
l.w = a
l.t = b
a.z = h
b.q = a
b.t = a
h.o = b
h.x = b
h.v = b
assert l.t.t.z.txt == "h"