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

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

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

e = A("e")
n = B("n")
k = C("k")
f = C("f")
c = B("c")
g = A("g")
a = B("a")

e.x = a
n.o = a
n.v = c
k.w = g
k.x = f
f.w = g
f.x = k
c.o = a
c.v = n
g.x = c
a.o = c
a.v = c
assert g.x.v.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

e = A("e")
n = B("n")
k = C("k")
f = C("f")
c = B("c")
g = A("g")
a = B("a")

e.x = a
n.o = a
n.v = c
k.w = g
k.x = f
f.w = g
f.x = k
c.o = a
c.v = n
g.x = c
a.o = c
a.v = c
assert g.x.v.o.o.o.o.txt == "c"