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

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

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

e = A("e")
b = B("b")
f = C("f")
g = C("g")
h = B("h")
n = C("n")
d = A("d")
i = A("i")
k = B("k")
c = C("c")

e.r = b
b.u = n
b.v = d
f.q = d
f.o = k
f.t = b
g.q = d
g.o = b
g.t = k
h.u = f
h.v = d
n.q = d
n.o = b
n.t = b
d.r = h
i.r = b
k.u = f
k.v = e
c.q = d
c.o = k
c.t = h
assert h.v.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

e = A("e")
b = B("b")
f = C("f")
g = C("g")
h = B("h")
n = C("n")
d = A("d")
i = A("i")
k = B("k")
c = C("c")

e.r = b
b.u = n
b.v = d
f.q = d
f.o = k
f.t = b
g.q = d
g.o = b
g.t = k
h.u = f
h.v = d
n.q = d
n.o = b
n.t = b
d.r = h
i.r = b
k.u = f
k.v = e
c.q = d
c.o = k
c.t = h
assert h.v.r.v.txt == "d"