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

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

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

d = A("d")
n = B("n")
j = C("j")
g = C("g")
e = A("e")

d.s = g
d.o = g
d.r = n
n.v = g
j.y = g
j.u = n
g.y = j
g.u = n
e.s = g
e.o = j
e.r = n
assert g.y.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: C = None
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
n = B("n")
j = C("j")
g = C("g")
e = A("e")

d.s = g
d.o = g
d.r = n
n.v = g
j.y = g
j.u = n
g.y = j
g.u = n
e.s = g
e.o = j
e.r = n
assert g.y.u.v.u.txt == "n"