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

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

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

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

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

a = A("a")
b = B("b")
j = C("j")
g = D("g")
l = E("l")
i = B("i")
h = B("h")

a.x = i
b.u = a
b.v = l
j.x = l
j.t = l
g.r = i
l.w = h
l.v = i
i.u = a
i.v = l
h.u = a
h.v = l
assert j.x.v.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

a = A("a")
b = B("b")
j = C("j")
g = D("g")
l = E("l")
i = B("i")
h = B("h")

a.x = i
b.u = a
b.v = l
j.x = l
j.t = l
g.r = i
l.w = h
l.v = i
i.u = a
i.v = l
h.u = a
h.v = l
assert j.x.v.u.x.u.txt == "a"