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

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

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

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

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

l.s = a
l.p = h
l.x = c
l.y = c
f.r = a
f.u = a
f.v = a
a.p = l
a.z = f
a.y = f
a.w = h
e.y = f
e.t = f
e.x = c
c.s = a
c.p = h
c.x = l
c.y = l
h.y = f
h.t = f
h.x = l
b.y = f
b.t = f
b.x = l
assert a.p.s.w.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: D = None
        self.x: A = None
        self.y: A = None
        self.txt = txt

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

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

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

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

l.s = a
l.p = h
l.x = c
l.y = c
f.r = a
f.u = a
f.v = a
a.p = l
a.z = f
a.y = f
a.w = h
e.y = f
e.t = f
e.x = c
c.s = a
c.p = h
c.x = l
c.y = l
h.y = f
h.t = f
h.x = l
b.y = f
b.t = f
b.x = l
assert a.p.s.w.x.x.x.txt == "l"