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

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

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

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

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

b.t = h
b.y = h
b.p = h
b.w = d
a.x = d
a.t = b
a.u = m
d.z = f
d.w = h
f.u = a
f.o = h
f.s = b
f.x = m
l.x = d
l.u = d
l.t = b
h.u = a
h.o = f
h.s = b
h.x = j
j.z = h
j.w = h
m.z = h
m.w = f
assert f.o.u.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: D = None
        self.p: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

b.t = h
b.y = h
b.p = h
b.w = d
a.x = d
a.t = b
a.u = m
d.z = f
d.w = h
f.u = a
f.o = h
f.s = b
f.x = m
l.x = d
l.u = d
l.t = b
h.u = a
h.o = f
h.s = b
h.x = j
j.z = h
j.w = h
m.z = h
m.w = f
assert f.o.u.t.w.txt == "d"