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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

e = A("e")
h = B("h")
k = C("k")
a = D("a")
d = A("d")
g = A("g")

e.p = h
e.y = g
e.v = k
h.o = k
k.u = h
k.t = h
k.x = e
k.y = d
a.q = e
d.p = h
d.y = e
d.v = k
g.p = h
g.y = e
g.v = k
assert g.y.y.y.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: A = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

e = A("e")
h = B("h")
k = C("k")
a = D("a")
d = A("d")
g = A("g")

e.p = h
e.y = g
e.v = k
h.o = k
k.u = h
k.t = h
k.x = e
k.y = d
a.q = e
d.p = h
d.y = e
d.v = k
g.p = h
g.y = e
g.v = k
assert g.y.y.y.v.x.txt == "e"