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

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

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

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

e = A("e")
f = B("f")
h = C("h")
b = D("b")
k = A("k")

e.v = b
e.r = b
e.s = f
e.p = f
f.u = h
f.t = b
h.o = f
h.r = f
h.v = b
b.s = e
b.y = e
b.x = e
b.r = f
k.v = b
k.r = b
k.s = f
k.p = f
assert h.v.x.r.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: B = None
        self.p: B = None
        self.r: D = None
        self.txt = txt

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

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

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

e = A("e")
f = B("f")
h = C("h")
b = D("b")
k = A("k")

e.v = b
e.r = b
e.s = f
e.p = f
f.u = h
f.t = b
h.o = f
h.r = f
h.v = b
b.s = e
b.y = e
b.x = e
b.r = f
k.v = b
k.r = b
k.s = f
k.p = f
assert h.v.x.r.y.v.txt == "b"