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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: E = None
        self.y: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: E = None
        self.s: A = None
        self.u: D = None
        self.w: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: E = None
        self.y: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: E = None
        self.s: A = None
        self.u: D = None
        self.w: F = None
        self.txt = txt

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

c.q = f
c.v = g
j.y = l
j.t = f
g.u = a
g.z = a
g.y = l
l.s = a
l.t = c
a.y = g
a.t = c
a.q = j
f.s = l
b.x = l
b.u = l
b.t = a
b.s = c
b.w = f
assert b.s.v.u.q.txt == "j"