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

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

i = A("i")
g = B("g")
f = C("f")
a = D("a")
e = E("e")
h = A("h")

i.t = g
i.u = f
g.u = i
f.p = h
f.v = g
a.w = i
a.r = e
e.p = a
h.t = g
h.u = f
assert f.v.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

i = A("i")
g = B("g")
f = C("f")
a = D("a")
e = E("e")
h = A("h")

i.t = g
i.u = f
g.u = i
f.p = h
f.v = g
a.w = i
a.r = e
e.p = a
h.t = g
h.u = f
assert f.v.u.t.u.t.txt == "g"