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

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

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

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

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

c = A("c")
f = B("f")
k = C("k")
j = D("j")
h = E("h")

c.u = j
c.t = k
c.w = f
f.t = h
k.p = h
k.t = h
j.x = c
j.r = c
j.z = h
j.y = f
h.o = f
assert j.x.t.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

c = A("c")
f = B("f")
k = C("k")
j = D("j")
h = E("h")

c.u = j
c.t = k
c.w = f
f.t = h
k.p = h
k.t = h
j.x = c
j.r = c
j.z = h
j.y = f
h.o = f
assert j.x.t.p.o.txt == "f"