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

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

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

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

j = A("j")
d = B("d")
a = C("a")
g = D("g")
n = A("n")
k = C("k")
i = D("i")

j.u = g
j.o = n
d.x = a
a.v = d
a.t = d
a.y = j
g.x = d
n.u = i
n.o = j
k.v = d
k.t = d
k.y = n
i.x = d
assert n.u.x.x.v.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: A = None
        self.txt = txt

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

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

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

j = A("j")
d = B("d")
a = C("a")
g = D("g")
n = A("n")
k = C("k")
i = D("i")

j.u = g
j.o = n
d.x = a
a.v = d
a.t = d
a.y = j
g.x = d
n.u = i
n.o = j
k.v = d
k.t = d
k.y = n
i.x = d
assert n.u.x.x.v.x.t.txt == "d"