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

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

class C:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: C = None
        self.txt = txt

b = A("b")
a = B("a")
d = C("d")
c = A("c")
h = B("h")
k = C("k")
f = B("f")
e = B("e")
j = C("j")
g = A("g")

b.o = h
b.v = f
a.w = j
a.o = k
a.p = h
d.z = k
d.r = j
c.o = h
c.v = f
h.w = d
h.o = d
h.p = f
k.z = j
k.r = j
f.w = j
f.o = j
f.p = a
e.w = d
e.o = d
e.p = a
j.z = k
j.r = d
g.o = h
g.v = f
assert c.v.p.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: C = None
        self.txt = txt

b = A("b")
a = B("a")
d = C("d")
c = A("c")
h = B("h")
k = C("k")
f = B("f")
e = B("e")
j = C("j")
g = A("g")

b.o = h
b.v = f
a.w = j
a.o = k
a.p = h
d.z = k
d.r = j
c.o = h
c.v = f
h.w = d
h.o = d
h.p = f
k.z = j
k.r = j
f.w = j
f.o = j
f.p = a
e.w = d
e.o = d
e.p = a
j.z = k
j.r = d
g.o = h
g.v = f
assert c.v.p.p.o.txt == "d"