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

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

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

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

m = A("m")
b = B("b")
g = C("g")
l = D("l")
d = A("d")
f = C("f")
h = C("h")
c = B("c")
n = D("n")

m.z = d
m.t = b
b.u = h
b.z = l
g.w = d
l.r = n
l.y = d
l.v = m
d.z = m
d.t = b
f.w = d
h.w = m
c.u = g
c.z = n
n.r = l
n.y = d
n.v = m
assert b.u.w.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: B = None
        self.txt = txt

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

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

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

m = A("m")
b = B("b")
g = C("g")
l = D("l")
d = A("d")
f = C("f")
h = C("h")
c = B("c")
n = D("n")

m.z = d
m.t = b
b.u = h
b.z = l
g.w = d
l.r = n
l.y = d
l.v = m
d.z = m
d.t = b
f.w = d
h.w = m
c.u = g
c.z = n
n.r = l
n.y = d
n.v = m
assert b.u.w.z.z.txt == "m"