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

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

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

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

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

l = A("l")
f = B("f")
b = C("b")
h = D("h")
n = E("n")

l.x = f
l.y = b
l.u = h
f.z = h
f.t = l
b.v = h
b.t = l
h.x = l
h.r = f
h.u = n
n.u = b
n.v = h
assert h.r.z.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: C = None
        self.u: D = None
        self.txt = txt

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

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

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

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

l = A("l")
f = B("f")
b = C("b")
h = D("h")
n = E("n")

l.x = f
l.y = b
l.u = h
f.z = h
f.t = l
b.v = h
b.t = l
h.x = l
h.r = f
h.u = n
n.u = b
n.v = h
assert h.r.z.u.v.txt == "h"