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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.s: F = None
        self.y: B = None
        self.p: C = None
        self.u: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: D = None
        self.r: F = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

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

c = A("c")
f = B("f")
n = C("n")
g = D("g")
j = E("j")
b = F("b")

c.v = n
c.q = n
c.s = g
c.y = f
c.x = b
f.q = j
n.x = f
n.p = f
n.y = g
g.v = j
g.s = b
g.y = f
g.p = n
g.u = n
j.o = g
j.v = g
j.x = g
j.r = b
j.s = c
b.w = c
assert j.s.x.w.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: D = None
        self.y: B = None
        self.x: F = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.s: F = None
        self.y: B = None
        self.p: C = None
        self.u: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: D = None
        self.r: F = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

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

c = A("c")
f = B("f")
n = C("n")
g = D("g")
j = E("j")
b = F("b")

c.v = n
c.q = n
c.s = g
c.y = f
c.x = b
f.q = j
n.x = f
n.p = f
n.y = g
g.v = j
g.s = b
g.y = f
g.p = n
g.u = n
j.o = g
j.v = g
j.x = g
j.r = b
j.s = c
b.w = c
assert j.s.x.w.y.q.txt == "j"