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

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

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

h = A("h")
d = B("d")
c = C("c")
n = C("n")
k = A("k")
f = B("f")
a = C("a")
l = A("l")

h.o = f
h.r = d
d.p = a
d.x = f
c.t = n
c.o = n
c.v = k
n.t = a
n.v = h
n.o = c
k.o = d
k.r = f
f.p = n
f.x = d
a.t = c
a.v = l
a.o = n
l.o = f
l.r = d
assert c.v.o.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: B = None
        self.txt = txt

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

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

h = A("h")
d = B("d")
c = C("c")
n = C("n")
k = A("k")
f = B("f")
a = C("a")
l = A("l")

h.o = f
h.r = d
d.p = a
d.x = f
c.t = n
c.o = n
c.v = k
n.t = a
n.v = h
n.o = c
k.o = d
k.r = f
f.p = n
f.x = d
a.t = c
a.v = l
a.o = n
l.o = f
l.r = d
assert c.v.o.x.x.txt == "d"