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

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

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

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

f.u = d
f.p = d
f.w = c
j.r = c
j.s = e
j.v = f
g.z = h
g.o = j
g.x = d
e.z = j
e.o = h
e.x = d
c.z = h
c.o = j
c.x = d
h.r = c
h.s = e
h.v = f
d.u = f
d.p = f
d.w = e
assert g.x.p.p.u.p.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: A = None
        self.w: C = None
        self.txt = txt

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

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

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

f.u = d
f.p = d
f.w = c
j.r = c
j.s = e
j.v = f
g.z = h
g.o = j
g.x = d
e.z = j
e.o = h
e.x = d
c.z = h
c.o = j
c.x = d
h.r = c
h.s = e
h.v = f
d.u = f
d.p = f
d.w = e
assert g.x.p.p.u.p.p.u.txt == "d"