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

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

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

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

e = A("e")
c = B("c")
g = C("g")
a = D("a")

e.x = g
e.s = c
c.r = g
c.p = e
c.v = e
c.z = a
g.p = c
g.w = c
g.u = e
a.y = c
assert c.p.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: B = None
        self.txt = txt

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

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

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

e = A("e")
c = B("c")
g = C("g")
a = D("a")

e.x = g
e.s = c
c.r = g
c.p = e
c.v = e
c.z = a
g.p = c
g.w = c
g.u = e
a.y = c
assert c.p.x.u.txt == "e"