class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.u: C = None
        self.w: B = None
        self.t: D = None
        self.x: F = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: C = None
        self.x: H = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: H = None
        self.y: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: H = None
        self.p: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

a = A("a")
f = B("f")
h = C("h")
n = D("n")
k = E("k")
m = F("m")
g = G("g")
i = H("i")
l = G("l")
j = D("j")

a.r = i
a.u = h
a.w = f
a.t = n
a.v = n
a.x = m
f.r = m
f.w = h
f.x = i
f.o = j
h.p = k
h.v = f
h.x = m
n.z = j
n.x = a
k.v = i
k.y = l
m.o = a
g.o = i
g.p = i
i.r = j
l.o = i
l.p = i
j.z = n
j.x = a
assert a.r.r.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.u: C = None
        self.w: B = None
        self.t: D = None
        self.x: F = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: C = None
        self.x: H = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: H = None
        self.y: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: H = None
        self.p: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

a = A("a")
f = B("f")
h = C("h")
n = D("n")
k = E("k")
m = F("m")
g = G("g")
i = H("i")
l = G("l")
j = D("j")

a.r = i
a.u = h
a.w = f
a.t = n
a.v = n
a.x = m
f.r = m
f.w = h
f.x = i
f.o = j
h.p = k
h.v = f
h.x = m
n.z = j
n.x = a
k.v = i
k.y = l
m.o = a
g.o = i
g.p = i
i.r = j
l.o = i
l.p = i
j.z = n
j.x = a
assert a.r.r.z.x.txt == "a"