class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: A = None
        self.p: C = None
        self.x: E = None
        self.u: D = None
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: F = None
        self.q: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: C = None
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: A = None
        self.z: C = None
        self.w: F = None
        self.s: D = None
        self.txt = txt

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

f.r = i
f.u = i
f.o = i
f.w = l
f.p = g
f.x = n
a.z = g
g.y = a
i.x = m
n.r = h
n.u = h
n.q = h
h.u = i
h.v = g
h.q = m
m.r = h
m.w = h
m.v = f
m.z = g
m.s = i
l.r = i
l.u = i
l.o = i
l.w = f
l.p = g
l.x = n
assert g.y.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: A = None
        self.p: C = None
        self.x: E = None
        self.u: D = None
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: F = None
        self.q: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: C = None
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: A = None
        self.z: C = None
        self.w: F = None
        self.s: D = None
        self.txt = txt

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

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