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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: C = None
        self.r: A = None
        self.w: E = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.u: F = None
        self.w: B = None
        self.z: A = None
        self.y: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

c = A("c")
f = B("f")
n = C("n")
j = D("j")
i = E("i")
d = F("d")
a = G("a")
g = B("g")
l = D("l")

c.z = n
c.o = d
c.u = g
f.q = d
f.t = n
f.r = c
f.s = c
f.w = i
n.r = a
j.z = a
j.r = n
j.x = f
j.o = f
j.q = d
i.x = a
i.u = d
i.y = d
i.w = g
i.z = c
d.z = c
a.w = g
g.q = d
g.t = n
g.r = c
g.s = c
g.w = i
l.z = a
l.r = n
l.x = f
l.q = d
l.o = g
assert f.t.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: F = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: C = None
        self.r: A = None
        self.w: E = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.u: F = None
        self.w: B = None
        self.z: A = None
        self.y: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

c = A("c")
f = B("f")
n = C("n")
j = D("j")
i = E("i")
d = F("d")
a = G("a")
g = B("g")
l = D("l")

c.z = n
c.o = d
c.u = g
f.q = d
f.t = n
f.r = c
f.s = c
f.w = i
n.r = a
j.z = a
j.r = n
j.x = f
j.o = f
j.q = d
i.x = a
i.u = d
i.y = d
i.w = g
i.z = c
d.z = c
a.w = g
g.q = d
g.t = n
g.r = c
g.s = c
g.w = i
l.z = a
l.r = n
l.x = f
l.q = d
l.o = g
assert f.t.r.w.txt == "g"