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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: D = None
        self.r: C = None
        self.txt = txt

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

e = A("e")
g = B("g")
f = C("f")
i = D("i")
l = A("l")
c = D("c")
h = C("h")

e.z = f
e.s = f
g.r = f
g.x = i
f.t = g
f.p = i
f.r = h
i.s = e
i.r = h
i.u = c
l.z = h
l.s = f
c.s = e
c.r = h
c.u = i
h.t = g
h.p = i
h.r = f
assert l.z.p.r.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: D = None
        self.r: C = None
        self.txt = txt

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

e = A("e")
g = B("g")
f = C("f")
i = D("i")
l = A("l")
c = D("c")
h = C("h")

e.z = f
e.s = f
g.r = f
g.x = i
f.t = g
f.p = i
f.r = h
i.s = e
i.r = h
i.u = c
l.z = h
l.s = f
c.s = e
c.r = h
c.u = i
h.t = g
h.p = i
h.r = f
assert l.z.p.r.r.t.txt == "g"