class A:
    def __init__(self, txt: str):
        self.x: D = 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.w: B = None
        self.q: C = None
        self.y: B = None
        self.txt = txt

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

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

h.x = e
l.o = k
k.w = l
k.y = l
k.q = n
g.v = e
g.x = l
g.t = h
g.y = k
e.v = g
e.x = l
e.t = h
e.y = k
n.w = l
n.y = l
n.q = k
d.x = e
assert g.t.x.v.v.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = 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.w: B = None
        self.q: C = None
        self.y: B = None
        self.txt = txt

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

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

h.x = e
l.o = k
k.w = l
k.y = l
k.q = n
g.v = e
g.x = l
g.t = h
g.y = k
e.v = g
e.x = l
e.t = h
e.y = k
n.w = l
n.y = l
n.q = k
d.x = e
assert g.t.x.v.v.t.x.txt == "e"