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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: D = None
        self.txt = txt

k = A("k")
l = B("l")
d = C("d")
c = D("c")
j = E("j")
e = D("e")
g = B("g")

k.u = l
l.u = g
l.v = j
l.x = c
d.u = j
d.q = c
d.o = k
c.x = k
c.t = d
j.v = l
j.t = c
e.x = k
e.t = d
g.u = l
g.v = j
g.x = e
assert k.u.v.t.t.u.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: D = None
        self.txt = txt

k = A("k")
l = B("l")
d = C("d")
c = D("c")
j = E("j")
e = D("e")
g = B("g")

k.u = l
l.u = g
l.v = j
l.x = c
d.u = j
d.q = c
d.o = k
c.x = k
c.t = d
j.v = l
j.t = c
e.x = k
e.t = d
g.u = l
g.v = j
g.x = e
assert k.u.v.t.t.u.t.x.txt == "k"