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

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

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

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

b = A("b")
l = B("l")
c = C("c")
e = D("e")
d = D("d")
h = A("h")

b.z = c
b.p = l
b.t = l
b.s = l
l.w = d
l.s = e
l.u = h
c.o = b
e.x = b
e.w = d
e.s = c
d.x = b
d.w = e
d.s = c
h.z = c
h.p = l
h.t = l
h.s = l
assert e.x.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: B = None
        self.t: B = None
        self.s: B = None
        self.txt = txt

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

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

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

b = A("b")
l = B("l")
c = C("c")
e = D("e")
d = D("d")
h = A("h")

b.z = c
b.p = l
b.t = l
b.s = l
l.w = d
l.s = e
l.u = h
c.o = b
e.x = b
e.w = d
e.s = c
d.x = b
d.w = e
d.s = c
h.z = c
h.p = l
h.t = l
h.s = l
assert e.x.z.o.txt == "b"