class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: E = None
        self.t: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

l.q = c
l.t = c
l.r = a
f.v = a
f.w = a
f.x = c
i.p = j
e.s = i
e.r = i
a.x = j
a.q = j
a.s = e
a.r = f
a.w = f
a.p = i
j.v = e
j.r = l
j.o = f
c.s = a
assert j.v.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: E = None
        self.t: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

l.q = c
l.t = c
l.r = a
f.v = a
f.w = a
f.x = c
i.p = j
e.s = i
e.r = i
a.x = j
a.q = j
a.s = e
a.r = f
a.w = f
a.p = i
j.v = e
j.r = l
j.o = f
c.s = a
assert j.v.s.p.txt == "j"