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

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

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

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

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

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

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

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

f.z = b
f.r = m
f.t = e
b.w = f
b.y = f
b.o = f
g.v = d
g.p = a
h.w = f
h.y = f
h.o = f
j.v = b
j.p = h
a.w = f
a.y = f
a.o = f
e.v = a
e.p = h
d.w = f
d.y = f
d.o = f
m.v = a
m.p = b
assert g.p.o.r.v.o.txt == "f"