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

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

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

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

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

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

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

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

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

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

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