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

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

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

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

m = A("m")
j = B("j")
h = C("h")
g = D("g")
d = C("d")
e = A("e")
k = D("k")
b = B("b")

m.o = d
m.q = d
m.z = j
m.u = g
j.z = g
j.u = b
j.t = d
j.x = h
h.y = m
g.u = d
g.v = d
d.y = m
e.o = d
e.q = d
e.z = j
e.u = k
k.u = h
k.v = d
b.z = k
b.u = j
b.t = d
b.x = d
assert m.u.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: C = None
        self.z: B = None
        self.u: D = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
h = C("h")
g = D("g")
d = C("d")
e = A("e")
k = D("k")
b = B("b")

m.o = d
m.q = d
m.z = j
m.u = g
j.z = g
j.u = b
j.t = d
j.x = h
h.y = m
g.u = d
g.v = d
d.y = m
e.o = d
e.q = d
e.z = j
e.u = k
k.u = h
k.v = d
b.z = k
b.u = j
b.t = d
b.x = d
assert m.u.u.y.txt == "m"