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

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: B = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: A = None
        self.v: C = None
        self.txt = txt

c = A("c")
a = B("a")
g = C("g")
e = D("e")
j = B("j")
b = B("b")
m = B("m")
k = B("k")

c.q = g
c.x = g
c.u = g
c.w = k
a.s = j
a.u = k
a.o = c
g.v = a
g.r = a
g.s = b
e.p = g
e.v = g
e.t = c
j.s = b
j.u = k
j.o = c
b.s = j
b.u = j
b.o = c
m.s = b
m.u = a
m.o = c
k.s = b
k.u = b
k.o = c
assert g.r.o.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = None
        self.u: C = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: B = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: A = None
        self.v: C = None
        self.txt = txt

c = A("c")
a = B("a")
g = C("g")
e = D("e")
j = B("j")
b = B("b")
m = B("m")
k = B("k")

c.q = g
c.x = g
c.u = g
c.w = k
a.s = j
a.u = k
a.o = c
g.v = a
g.r = a
g.s = b
e.p = g
e.v = g
e.t = c
j.s = b
j.u = k
j.o = c
b.s = j
b.u = j
b.o = c
m.s = b
m.u = a
m.o = c
k.s = b
k.u = b
k.o = c
assert g.r.o.w.s.txt == "b"