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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: D = None
        self.x: D = None
        self.w: D = None
        self.txt = txt

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

k = A("k")
n = B("n")
l = C("l")
b = D("b")
g = B("g")
h = C("h")
f = D("f")

k.o = h
k.t = b
n.t = h
n.s = h
n.v = k
n.u = g
l.u = b
l.x = b
l.q = f
l.w = f
b.x = n
g.t = h
g.s = h
g.v = k
g.u = n
h.u = b
h.q = b
h.w = b
h.x = f
f.x = n
assert g.u.t.w.x.u.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: D = None
        self.x: D = None
        self.w: D = None
        self.txt = txt

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

k = A("k")
n = B("n")
l = C("l")
b = D("b")
g = B("g")
h = C("h")
f = D("f")

k.o = h
k.t = b
n.t = h
n.s = h
n.v = k
n.u = g
l.u = b
l.x = b
l.q = f
l.w = f
b.x = n
g.t = h
g.s = h
g.v = k
g.u = n
h.u = b
h.q = b
h.w = b
h.x = f
f.x = n
assert g.u.t.w.x.u.t.x.txt == "f"