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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: B = None
        self.w: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

c = A("c")
l = B("l")
n = C("n")
m = D("m")
a = E("a")
d = F("d")
g = B("g")

c.y = n
c.s = m
c.x = m
l.s = m
l.t = g
l.w = c
n.q = m
n.u = g
n.z = c
m.w = c
m.u = c
m.r = c
m.p = a
m.y = a
a.z = g
a.r = g
a.q = n
a.y = d
a.w = d
d.t = a
g.s = m
g.t = l
g.w = c
assert d.t.q.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: B = None
        self.w: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

c = A("c")
l = B("l")
n = C("n")
m = D("m")
a = E("a")
d = F("d")
g = B("g")

c.y = n
c.s = m
c.x = m
l.s = m
l.t = g
l.w = c
n.q = m
n.u = g
n.z = c
m.w = c
m.u = c
m.r = c
m.p = a
m.y = a
a.z = g
a.r = g
a.q = n
a.y = d
a.w = d
d.t = a
g.s = m
g.t = l
g.w = c
assert d.t.q.u.w.txt == "c"