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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

l.w = c
l.p = a
b.r = c
b.s = a
b.y = f
f.q = j
f.r = j
f.y = b
f.s = n
f.p = n
f.w = c
n.q = c
a.p = f
a.x = f
a.w = c
a.u = b
c.p = j
j.p = l
assert f.q.p.p.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

l.w = c
l.p = a
b.r = c
b.s = a
b.y = f
f.q = j
f.r = j
f.y = b
f.s = n
f.p = n
f.w = c
n.q = c
a.p = f
a.x = f
a.w = c
a.u = b
c.p = j
j.p = l
assert f.q.p.p.x.y.txt == "b"