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

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

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

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

b = A("b")
c = B("c")
e = C("e")
n = D("n")
g = D("g")
h = A("h")

b.v = e
c.o = e
e.y = c
e.w = c
e.o = c
e.u = h
n.r = c
g.r = c
h.v = e
assert c.o.y.o.u.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

b = A("b")
c = B("c")
e = C("e")
n = D("n")
g = D("g")
h = A("h")

b.v = e
c.o = e
e.y = c
e.w = c
e.o = c
e.u = h
n.r = c
g.r = c
h.v = e
assert c.o.y.o.u.v.w.txt == "c"